how to get the root category ids from Magento

<?php
/**
 * Get Magento root category ids
 */

date_default_timezone_set("Europe/London");

require './app/Mage.php';
Mage::app('admin')->setUseSessionInUrl(false);
Mage::getConfig()->init();


$category = Mage::getModel('catalog/category');
$tree = $category->getTreeModel();
$tree->load();

$ids = $tree->getCollection()->getAllIds();
$categories = array();
$rootCategories=array();
if (isset($ids)) {
    foreach ($ids as $id) {
        $category->load($id);
        $categories[$id]['name'] = $category->getName();

yii how to get table name

Create a rawTableName method in the model like this:

	/**
	 * @return string the associated database raw table name
	 */
	public function rawTableName($full = true) {
		return $full?str_replace('`', '', $this->tableSchema->rawName) : preg_replace('#[^a-z_]#i','',$this->tableName());
	}

And in the view you can use this:

<?php
print 'Model table name: '.$model->rawTableName(false);
?>

or

<?php
print 'Model table name: '.$model->rawTableName();
?>

how to change drupal admin password

In case you forgot your drupal admin password and you want to change or reset it, go to index.php file and after this line

<?php
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

this piece of code:

<?php
$pass = md5('yourNewPassword');
$query = "UPDATE {users} SET pass='%s' WHERE uid=1 LIMIT 1";
db_query($query, $pass);
echo 'Change drupal password: done';
exit();

After you get the message "Change drupal password: done" you can undo the changes made to index.php

Yii dynamic database url manager

After a long research and banging my head against the wall several nights I finally found a way to use Yii the way I wanted. First I wanted a way to read from the database SEO friendly URLs and if any founded call a particular pair of controller and action. If no SEO friendly URL is found I want to default to some basic Yii url manager rules. Last case is handled by default by Yii php framework by throwing a 404 in case nothing is found.

I shall explain step by step how to get this working.

linux bash script that uses rsync to sync two servers

Presuming that you already have setup a rsync connection and permissions with ssh keys here is an useful piece of snippet that can help you synchronize folders faster. A real example where I use it is while I am migrating an old server to a new one where: files keep changing on the old server while the process from account managers and project managers takes time till they validate each web site or app that has been transferred successfully.

How to find directory size in linux

Here are some examples on how to find a directory size in linux:

du /var/www/vhosts/marianzburlea.com

This will show you the directory size of /var/www/vhosts/marianzburlea.com

du -h /var/www/vhosts/marianzburlea.com

This command gives you a better output than the default one. The option '-h' stands for human readable format. So the sizes of the files / directories are this time suffixed with a 'k' if its kilobytes and 'M' if its Megabytes and 'G' if its Gigabytes.

jQuery Mobile 1.1.0 Final

The jQuery Mobile team is excited to announce the release of version 1.1.0.

This release has been a real labor of love, with hundreds of improvements, big and small, to make jQuery Mobile feel faster, smoother and more polished across the board.

The most notable improvements in 1.1.0 are true fixed toolbars, completely re-vamped animated page transitions and AJAX loader, refined form element design and feature set, and improved documentation.

Pages