Alex (SirShurf) Frenkel's Blog

A web log of a PHP professional

My First WordPress commertial grade plugin – Gravity Form Popup Widget

with 13 comments

Well, today I have uploaded my first commercial grade WordPress plug-in to the website.

The plug-in is an extension to the most useful Form Generator to WordPress. This plug-in simply adds the form in a widget inside a jQuery UI Dialogue module. And adds a delay to it (the delay is managed from the Widgets management screen).

Another thing added is an option to add a text before the form with an option to insert page title in a text.

The plug-in is located here:

Any comments are welcomed.

Written by Alex (Shurf) Frenkel

October 28, 2011 at 5:45 pm

Using External SVN with Zend Studio (Eclipse)

leave a comment »

Well, it looks like I found finally how to work with SVN Externals in Zend Studio.

You cannot!

In order to work with SVN and Zend Studio you have to go to command line and work with SVN only. Figurs…

Written by Alex (Shurf) Frenkel

October 23, 2011 at 7:44 pm

Posted in IDE, SVN

Tagged with , ,

Ubuntu Server Topping CPU on Amazon Micro instance.

with one comment

I have got a micro instance on Amazon. For some reason ones in a while it’s CPU is topping up and the only thing I can do about it at that moment is Hard Reboot.

I have been trying to catch that sucker for the past half a year, set up Nagios to monitor when it is failing but no avail.

On the same server I have got a Magento Store (Nes Jewellery) and I noticed that ones Baide spider was on the server it was running slow. I fixed the spider problem but have left an open terminal with TOP working on it and forgot about it.
Yesterday I am getting a notification from Nagios that my instance is down. I have checked my terminal and the TOP was stuck on the last information he got and the top CPU killer was “update-apt-xapi”. This is a partial string from “update-apt-xapian-index” a part of the “apt-xapian-index” package.

What it turned out, Ubuntu (starting from version 10.04 and up to 11.04 at least) has an error in the cron script for apt update. But on a single CPU with limited memory that was critical!

The fix for this is really simple (and it’s stated that it’s included in 11.10). You need to edit 2 cron files (dont forget to have root permissions for that)
First is /etc/cron.weekly/apt-xapian-index
# Rebuild the index
if [ -x $CMD ]
if [ -x $IONICE ]
nice -n 19 $IONICE -c 3 $CMD --update --quiet
nice -n 19 $CMD --update --quiet

The second file is /etc/cron.daily/apt
if [ -x /usr/sbin/update-apt-xapian-index ]; then
nice -n 19 ionice -c3 update-apt-xapian-index --update -q

Now all is left is to see that there is no more calls like that.

Written by Alex (Shurf) Frenkel

October 23, 2011 at 6:00 pm

Posted in Magento, Ubuntu

Tagged with , , ,

A new generic module for Zend framework – Menu Module

leave a comment »

I have created a new generic self containing module that works with Zend framework MVC application.

The module is a Menu Module, it manages menu for MVC application and using a bootstrap and substitutes it over the menu added in the config.

Here is the link to it:

Currently it depends on my jQGrid Library and on Belleron-Frenkel library (an extension on Zend Framework standard modules)

Any help/idea is welcomed šŸ™‚

Written by Alex (Shurf) Frenkel

October 22, 2011 at 12:10 pm

Posted in IDE, jQGrid, Uncategorized, Zend Framework

Tagged with , , ,

memcached-top or a way to see how much your memcachd is full….

leave a comment »

Over the past days I have found that my Amazon Micro account was getting to a load level of 120%, with an uptime of 30+. After some search I found that the problem was in search crawlers (GoogleBot, GoogleImage and BAIDA at the same time) over Magento installation I have there.

So, after some web searches, I derided to install some caching. Minified all CSS/JS and added GZIP compression to Apache but it was not enough, so I added a memcached which was.

But now I had a question of how can I know how many is used of my memcached instance? Maybe I need another one? I have not found any information on the memcached forum but what I did found was a little application called “memcached-top” that is hosted on google code.

This small script creates a display like TOP to the memcachd instances you have (in my case it’s only 1 instance…. but still)

The installation/usage of the application is really simple:

$ curl > ~/bin/memcache-top $ chmod +x ~/bin/memcache-top $ memcache-top --sleep 1 The result looks like that: Ā memcached-top screen shot 

Written by Alex (Shurf) Frenkel

October 21, 2011 at 5:22 pm

Posted in IDE, memcached

A new domain…

leave a comment »

Well not know if anybody noticed but I have decided to move this blog to it’s own domain name.

Going to play with WordPress MultiSite

Written by Alex (Shurf) Frenkel

October 20, 2011 at 8:23 pm

Posted in Uncategorized

Zend Framework – Howto Autoload a model inside your module!

leave a comment »

I have lost about an hour today battling this. I have a normal ZF directory structure:










But for some reasoneĀ  file located in /admin/moduls was not loaded authomaticly.

The problem was in missing Bootstrap.php located in the module root directory. It looks like this extention from Zend_Application_Module_Bootstrap makes the trick.

So all you have to do is to add a class:

class Admin_Bootstrap extends Zend_Application_Module_Bootstrap {}

And it will work!

Written by Alex (Shurf) Frenkel

August 28, 2011 at 1:38 pm

JQuery & CSS Dropw down menu

leave a comment »

I have been looking for a long time for a JQuery/CSS drop down menu that would not clash with Zend Framework, and especially with Zend Navigation.

This is the one that comes closest:

Written by Alex (Shurf) Frenkel

August 23, 2011 at 10:17 am

Posted in Uncategorized

Tagged with , , , , ,

jQGrid with Zend Framework Updated

with 9 comments

Recently I had some time to update the fork I have of the jQGrid encapsulation for Zend Framework.

Among the things updated is:
* Support for jQGrid 4.1.
* Support for methods in options.
* 2 new decorators
* New special decorator, a multi select element on grid search.
* Support for advanced search

And many more…
You can locate the code at my GitHub:

If you dont use jQGrid it is an Ajax-enabled JavaScript control that provides solutions for representing and manipulating tabular data on the web.

Written by Alex (Shurf) Frenkel

August 22, 2011 at 7:19 pm

How to use Zend-Framework-PDF-Table-Helper

with 10 comments

Here is the example of how to user ZendFramework PDF-Table-Helper.

You can get the code from GitHub here:

One of the prerequisites is that you mast have the zf_autoloader on and configured since I am relaying on it to auto load files.

first you have to in instantiate the class:

$pdf = new SirShurf_Pdf_TableSet ();

You can instantiate it with a Zend_PDF object and without it, in which case it will be created for you, but if you are instantating with Zend_PDF you have to tell the system on what page you are working (Default is page 0).

Now what you need it to initialise a Table you are going to work with:
$objTableRow = $table->addRow ();

Each table can have his own number of columns and settings.
Each table can have a different number of rows a row can be added using this method:

And as with HTML a row has a number of cells (or columns):
$objTableRow->addCol ( $strCourseId, array (
'bold' => false, 'colspan' => 1, 'align' => 'center'
) );
$objTableRow->addCol ( Labadmin_Models_Static::convertHebrew ( $this->view->translate ( 'LBL_GRADE_FORM_COURSE_ID' ) ), array (
'bold' => false, 'colspan' => 1, 'align' => 'center', 'font' => 'arial.ttf', 'fontBold' => 'arialbd.ttf'
) );

The Cell can have each own definitions as the example here shows, and you can iterate over the data to create it.

And finally you can call render(); in order to render the changes to PDF, or build(‘fileName’) to save the finale PDF to a file.

$pdf->build ( $strGradeFileLocation . $intTimeStamp . ".grade.pdf" );

Written by Alex (Shurf) Frenkel

July 26, 2011 at 3:15 pm