< Browse > Home / Archive by category 'HowTo'

| RSS


I successfully passed my Zend Framework certification exam couple weeks ago.  It has certainly been a challenging preparation for the past one and half month considering the scarcity of information about this exam available online. So I thought of sharing my exam prep in this post which can be useful for others who might take the exam in the near future.

Materials that I used:


  • Zend Framework Certification Study Guide
    http://downloads.zend.com/framework/generic/ZFC_Study_Guide_v1.pdf
  • “Zend Framework in Action” book by Rob Allen
    http://www.zendframeworkinaction.com/
    This is a great book about ZF by Rob Allen. I strongly recommend this. I would also suggest going through his website, it contains excellent resources for Zend Framework and ZFCE.
    http://akrabat.com/

  • ZF Programmers Reference and ZF Source code (v1.5)
    Every other blog post on ZFCE preparation will point you in this direction. It is so very important to go through the code and understand the real functions. As developers we might find it hard sometimes to read pages and pages of documentation. I have felt it, like when I was reading one chapter in the study guide, I felt very boring, but  the moment I browsed through the code, It was like I grasped everything in 1/10th the time.
  • Version is Zend Framework 1.5
    Always remember this exam is based on v1.5 and anything introduced in the newer versions will not be asked about in the exam. So if you are only looking from the exams perspective, you can limit your scope to just the 1.5 version.

My preparation for the exam

  • Went through the study guide twice or thrice, and familiarized myself well enough with the chapters and sections
  • Made a list of all the Classes, Methods and Constants used in the study guide
  • Cross referenced the stuff in the ZF Study guide and studied the concepts in Rob Allen book. Didn’t have to spend too much time studying outside the scope of the book. I would say you wouldn’t even have to study the entire book, just reference the chapters in the study guide. At this point you would have covered all theory concepts that you need to know.
  • Now I had a list of all the Classes, Functions and Constants, just studied them and their related functions and classes with the help “ZF Programmers Reference”. E.g. If the study guide talks about Zend_Memory::factory() and the book talks about Zend_Memory_Manager::create() also read up about Zend_Memory_Manager::createLocked() — related function, can be found in the ZF Programmers Reference. At this point I had covered all ZF Technicals (class/fn/constant names) that were needed scoped in the exam curriculum.
  • Exams will be a mix of PHP Concepts, ZF Theory and ZF Technicals. I am not sure if you are already a ZCE, but as far as I know ZFCE is also a “unit-wise-pass” exam like ZCE. So studying all units is mandatory (I am just doing a presumed guess… I may be wrong by 99.9999989% here).
  • I found a lot of trick questions, so beware!! One of my colleagues suggested a way to handle trick questions in exams: “Never look at the choices until you are sure that you don’t know the answer”, I think it works well. The choices are the confusing part in the trick questions, and they can confuse you even if you had known the answer, so try to find the answer before looking at the choices.
  • Exams is for 75 Question in 90 mins, I finished it in about 30 mins and took 10 mins for review.
  • If all goes well you get to use this logo in your CV

All the best!!

[ View Post ]

Zend Framework and Zend Gdata API provide a simple and effective solution to display pictures and galleries from your picasa account in your own custom website. Lets take one of the public galleries in picasa show it in a custom php page in this website.

Zend Framework
Before we start. In order to use Zend Gdata API, you need to have Zend framework (1.6 or higher) installed, If you have the full framework package installed , you won’t need to worry about anything, you can go ahead and start calling the APIs directly, In case if you don’t have the full framework package installed, you will have to download and configure Google Data Client Library. Details of setup and configuration are listed in the following link

http://code.google.com/apis/gdata/articles/php_client_lib.html#gdata-installation

CODE :)
The following url refers to a public picasa gallery

http://picasaweb.google.com/shasankar/SampleGallery#

The URL has two important pointers, the picasa user id the one that follows the picasaweb.google.com domain, its usually the picasa user name, in some cases it can also be a long alphanumeric string, this is the user id, the other one is the gallery name, in this case it is ‘SampleGallery’

The following script allows you to load pictured directly into your website


<?php
error_reporting(E_ALL);
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_Photos');

// Album and User
$sUserID = "shasankar";
$sAlbumName = "SampleGallery";

$serviceName = Zend_Gdata_Photos::AUTH_SERVICE_NAME;
$gp = new Zend_Gdata_Photos();
$query = $gp->newAlbumQuery();
$query->setUser($sUserID);
$query->setAlbumName($sAlbumName);
$query->setImgMax("800");
$query->setThumbSize("160");
$albumFeed = $gp->getAlbumFeed($query);
$sPrintThumbs = "";

foreach ($albumFeed as $albumEntry) {
if ($albumEntry->getMediaGroup()->getThumbnail() != null) {
// Load Thumbnail Info
$mediaThumbnailArray = $albumEntry->getMediaGroup()->getThumbnail();
$ThumbnailUrl = $mediaThumbnailArray[0]->getUrl();
$ThumbnailHeight = $mediaThumbnailArray[0]->getHeight();
$ThumbnailWidth = $mediaThumbnailArray[0]->getWidth();
// Load Picture Info
$mediaArray = $albumEntry->getMediaGroup()->getContent();
$ImageUrl = $mediaArray[0]->getUrl();
$sImageTitle = $albumEntry->getMediaGroup()->getDescription()->text;
$url = $albumEntry->getLink('alternate')->href;

$sLinkString = <<<LTEXT
<a href="$ImageUrl" title="$sImageTitle"><img src="$ThumbnailUrl" width="$ThumbnailWidth" height="$ThumbnailHeight" /></a>
LTEXT;
$sPrintThumbs .=$sLinkString ;
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title> Loading pictures from Picasa Gallery</title>
</head>
<body >
<div>
<div>
<h3>SampleGallery (Picasa)</h3>

</div>
<div>
<?php echo $sPrintThumbs; ?>
</div>
</div>
<div class="clear"></div>
</body>
</html>

The Api allows lot of customization options, thumbnail size, final image size, number of results per page, etc, these setting have to passed along with the Album query that is sent to picasa.

Picasa album in Custom Webpage

Related Links

If you want to display private picasa galleries in your website, you can make use of zend authentication api, you can read more about it here

http://www.ibm.com/developerworks/library/x-picasalbum/#c5

[ View Post ]

CSS Hacks for IE8

[ More ] Dec 17, 2009 | No Comments | Posted in HowTo, Web Development |

Here it is, CSS Hacks for IE8, But, be little cautious while using them, sometimes, they may not work well with complex CSS syntaxes.

IE8 Standards-Mode Only:

.test { color /*\**/: blue\9 }

All IE versions, including IE8 Standards Mode:

.test { color: blue\9 }

[ View Post ]

Public waves allow wave users to publish and share their waves with other Google Wave users, and hence allowing everyone to contribute and make changes in the wave

Accessing public waves

To access public waves, you will need to enter the following keyword, in the search box

with:public

To search public waves, you can use a with:public following by the search string, for eg.

with:public Chennai

Will return all public waves with the keyword Chennai

Accessing public waves

Accessing public waves

Making a wave public

In order to make a wave public and to grant access to everyone, you will need to give access to the user called public@a.gwave.com. In the add contact screen , fill in public@a.gwave.com and Press “Enter”, even if the submit button is not activated, the public user will be added to your account. This looks like a bug in the wave system, expecting Google to fix it soon.

Once this user is added, any waves published along with this user will be available in public domain.

[ View Post ]

Often when working with large datasets, you will come across issues related to intense event overload for objects like table cells. This could translate to poor client JavaScript performance. The root cause for the performance lag is the large number of events that are associated and handled by web page at the client. Lets consider a scenario of highlighting cells in a table as follows

HTML


<table id="resultSetTable">
<tr id="row1">
<td class="nameCell"> UPS </td>
<td class="priceCell"> 2500 </td>
</tr>
<tr id="row2">
<td class="nameCell"> Mouse</td>
<td class="priceCell"> 300 </td>
</tr>
.
.
.
<tr id="row859">
<td class="nameCell"> Keyboard </td>
<td class="priceCell"> 250 </td>
</tr>
</table>

Javascript to highlight the selected cell


<script type="text/javascript">
$(function(){
$('.nameCell').click(function(){
if ($(this).css('background-color') != 'rgb(255, 0, 0)')
$(this).css('background-color', 'red');
else
$(this).css('background-color', 'green');
});

});
</script>

Although the code above works properly, the inefficiency of the above list code can be identifeid if the code is put through large datasets, since the javascript has to assign the event handler to all cells of the class “nameCell”, the Javascript engine gets overloaded with events, in a scenario of a few thousand rows, there are equal number of events being declared and handled simultaneously. This in some cases might cause the browser to crash. I got the following error when I tested this code with a large dataset on Firefox.

A script on this page may be busy, or it may have stopped responding. You can stop the script now, open the script in the debugger, or let the script continue.
Script: jquery-1.3.2.min.js:18

An alternate way to handle this problem will be to assign the event handler to a larger parent object, and to execute the event handler by validating the properties of the event. In this case the larger parent object is the Table. We can drill down to the class of the clicked cell of the table, see if it matches the ‘nameCell’ class type and then run the instructions, based on the validation. This mechanism is known as event delegation.


<script type="text/javascript">
$(function(){
$('table').click(function(event) {
var $thisCell, $tgt = $(event.target);
if ($tgt.is('td')) {
$thisCell = $tgt;
} else if ($tgt.parents('td').length) {
$thisCell = $tgt.parents('td:first');
}
// now do something with $thisCell
if ($($thisCell).attr("class")=="nameCell")
{
if ($($thisCell).css('background-color') != 'rgb(255, 0, 0)')
$($thisCell).css('background-color', 'red');
else
$($thisCell).css('background-color', 'green');
}
});
});
</script>

The web application saves lots of client computing power by avoiding the replication of thousands of events by delegating the event to a parent object. Proper use of event delegation in jQuery can help in excellent performance optimization of the web application.

References

  • Working with Events by Karl Swedberg -
    http://www.learningjquery.com/2008/03/working-with-events-part-1
[ View Post ]