Alex (SirShurf) Frenkel's Blog

A web log of a PHP professional

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…

Advertisements

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 ]
then
if [ -x $IONICE ]
then
nice -n 19 $IONICE -c 3 $CMD --update --quiet
else
nice -n 19 $CMD --update --quiet
fi
fi

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
fi

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:
https://github.com/sirshurf/MenuModule

Currently it depends on my jQGrid Library https://github.com/sirshurf/iphp and on Belleron-Frenkel library (an extension on Zend Framework standard modules) https://github.com/sirshurf/Belleron-Frenkel

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 http://memcache-top.googlecode.com/files/memcache-top-v0.6 > ~/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:
/Application

/modules

/default

/controllers

/moduls

/views

/admin

/controllers

/moduls

/views

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:
http://www.noupe.com/tutorial/drop-down-menu-jquery-css.html

Written by Alex (Shurf) Frenkel

August 23, 2011 at 10:17 am

Posted in Uncategorized

Tagged with , , , , ,