Warning: Parameter 1 to wp_default_scripts() expected to be a reference, value given in /home/michelk9/public_html/omaroid.com/wp-includes/plugin.php on line 601

Warning: Parameter 1 to wp_default_styles() expected to be a reference, value given in /home/michelk9/public_html/omaroid.com/wp-includes/plugin.php on line 601
Blog | Omaroid

My Blog


View All Posts In My Blog »

PHP PECL Solr 2.1.0 Released

1.17.2015 | 6 Comments

I’m pleased to announce that The Official PHP Solr Extension 2.1.0 is out with exciting features.


The Solr extension allows you to communicate effectively with The Apache Solr Server in PHP.

The Solr extension is an extremely fast, light-weight, feature-rich library that allows PHP developers to communicate effectively with Solr Server instances.

There are built-in tools to add documents and make updates to The Solr Server.

Read more…

ZF Autocomplete: Zend Framework command autocompletion

6.02.2013 | 0 Comments

zend framework

Zftool is a nifty feature from Zend Framework, however It’s pretty tiring to remember all commands.

Using bash I’ve got a bunch of custom providers, and for that I have to remember all the commands or review them every time, so It’s missing a killer feature which is the bash command autocompletion.


  1. Clone it.
  2. Move it to bash completion scripts directory to be able to autocomplete zf providers and zf provider actions
  3. Enable ItI you want to run it immediately in the same opened shell you can do the following command

Note: It will be automatically available in any new shell.

Custom Providers and Caching

In case you are wondering, I’ve got many projects with many custom providers, will it autocomplete them?

The answer is YES, and it fetches the providers per directory basis. Since the fetching and filtering is a pretty heavy process, it caches the autocompleted options in /tmp/ so that it will only be slow the first time, and then it’s going to be blazing fast.

Clear ZF autocomplete cache for providers and actions

To clear the cache, you will need to delete the cache files in tmp, the following command will do the job for you.

Hope that would be helpful for you!

CakePHP Locale and Routing

7.31.2012 | 2 Comments


When I was working on the cakephp localization ( l10n ) and internationalization ( i18n ), I came across a problem so I decided to let the world know about it if anyone had got the same issue.

What we want here is that a user can go to the localized version of the website according to the URL identified, for instance we want the website to load the English locale when we pass a URL like this http://example.tld/eng/Controller/Action

The problem is that while implementing the routes for the language detection, the plugins made a conflict with the rules in the routes file. Language routing is easy but sometimes can be tricky.
Read more…

PHP Variable Variables and Variable Constants

6.17.2012 | 1 Comment

In this small article I’ll illustrate PHP’s variable variables and Variable constants. There is no variable constants in PHP but I’m introducing a methodology to implement the same approach and achieve the same functionality as variable variables.
Read more…

PHP: get and set custom HTTP headers

5.01.2012 | 4 Comments

In this short tutorial I will illustrate how can you send and read custom HTTP headers using php.

First let’s start by sending a custom HTTP header to the server. I will be using cURL library to send HTTP requests.

Read more…

Cakephp: Force SSL on certain actions

3.15.2012 | 6 Comments

After going here and there and implementing alot of solutions, I found that every post request is getting redirected to get even if it was with HTTPS because of the implementation of the ForceSSL in the manual, so my word to you, save your time and implement this simple solution. I have tested it on cakephp 2.0 however I think it wouldn’t mind to work on cakephp 1.3
Read more…

Cakephp: Pagination sorting from foreign fields (fields from associated models)

3.06.2012 | 1 Comment

I came across a problem while developing with cakephp 2.0.

Suppose that you have got a Post model and a Category model, and you have a grid, with all posts and the category title they belong to. In order to sort by the category title you will need to do as the following in your view.

echo $this->Paginator->sort('Category.title','labelForTheTableHeader');

Hope that helps anyone

Egypt’s Mobile Number Change

11.06.2011 | 2 Comments

I’ve developed a snipped to correct the old numbers with the new numbers

The number change schema as follows:

(old -> new)


012 XXX XXXX -> 0122 XXX XXXX
017 XXX XXXX -> 0127 XXX XXXX
018 XXX XXXX -> 0128 XXX XXXX
0150 XXX XXXX -> 0120 XXX XXXX


011 XXX XXXX -> 0111 XXX XXXX
014 XXX XXXX -> 0114 XXX XXXX
0152 XXX XXXX -> 0112 XXX XXXX


010 XXX XXXX -> 0100 XXX XXXX
016 XXX XXXX -> 0106 XXX XXXX
019 XXX XXXX -> 0109 XXX XXXX
0151 XXX XXXX -> 0101 XXX XXXX

so here is my little php function that will use regular expressions

function changeMobileNumbers(&$contents){
	// vodafone
	$contents = preg_replace('/(0151)([0-9]{7})/', '0101$2', $contents);
	$contents = preg_replace('/(010)([0-9]{7})/', '0100$2', $contents);
	$contents = preg_replace('/(016)([0-9]{7})/', '0106$2', $contents);
	$contents = preg_replace('/(019)([0-9]{7})/', '0109$2', $contents);
	// etisalat
	$contents = preg_replace('/(0152)([0-9]{7})/', '0112$2', $contents);
	$contents = preg_replace('/(011)([0-9]{7})/', '0111$2', $contents);
	$contents = preg_replace('/(014)([0-9]{7})/', '0114$2', $contents);
	// mobinil
	$contents = preg_replace('/(0150)([0-9]{7})/', '0120$2', $contents);
	$contents = preg_replace('/(012)([0-9]{7})/', '0122$2', $contents);
	$contents = preg_replace('/(017)([0-9]{7})/', '0127$2', $contents);
	$contents = preg_replace('/(018)([0-9]{7})/', '0127$2', $contents);
	return $contents;

Hope that was useful

How to reset MySQL root password

10.26.2011 | 4 Comments

In this article I’ll go through resetting MySQL root password the easiest way

We are going to stop the MySQL daemon to be able to run it in safe mode, then we are going to skip grant tables, which means we are skipping password authentication, then we will set our new password
Read more…

Changing Window Icon in Tkinter

8.03.2011 | 0 Comments

Tkinter is the most commonly used GUI programming toolkit for python

Here is how you can change the program icon in tkinter
Read more…