Archive for the ‘


’ Category

The CArrayDataProvider problem of Yii

Recently I started digging in the YiiFramework. The first things I want to know about the framework were the basics – how the MVC is accomplished, database connections, ready to use component and so on. As the development team is actually the team that was engaged with the Prado framework before, I assumed that Yii will be very similar which actually is not very true. Well I won’t talk now about all the stuff I noticed and I will go straight to one of the first things I got a little irritating.
Read more

Adding a number of random generated unique strings into db

Today I accidentally got to a piece of code I have written long ago and really got surprised from me. I have created a not conventional solution to a interesting problem. Imagine you have to add a bunch of rows into a db table, for example promo codes, that has column holding randomly generated strings. The strings should be unique of course, so we have unique key in the db! So instead of generating the string, checking if it is already in the table and if not -> adding it to the table, I have just written this:

$j = 0;
for($i=0; $i<$count; $i++)
			$code = str_makerand();
			$codeID = $this->addItem(

		catch(Exception $e){
			if($j=10) break;

Integrating PHPList and CodeIgniter

Hello to all. It was a busy month ,so I haven’t updated this blog for soo loong. Now I give you a small bonus :) . I was busy with a lot of stuff including writing a library for CodeIgniter dealing with PHPList integration. Before implementing it, I googled a lot for a ready to use library on this particular subject. No luck. So I found myself writing it for an hour and think it is pretty good in doing its job, at least for me :) Here is the library Read more

Non-latin characters in the url and ajax problems

These troubles have some history for me. In a month a go I experienced problems with calling ajax scripts with url holding utf8 characters – bulgarian alphabet for example. So I wrote a javascript function which Read more

PayPal and its account optional setting

I had played with PayPal’s integration in a few online stores but never got to this stupid situation. For those that are not aware, the ‘Account Optional Setting’ allows the customers of an online store to pay directly, supplying the credit/debit/prepaid card information. This is really really awesome feature, because creating PayPal account is actually not enough to make a payment. Customers must verify their cards through PayPal which is done by moving through some steps including: Read more

Prado and its page state

I had some hard time tracking a bug of mine. The website is powered with the Prado framework latest version. It happened that the bug was a little tricky to be found. I have extended the TPage class and using it as MTPage. There I had a function used by a TDropDownList which is AutoPostBack enabled on changing the selected index – on the function executes $this->Response->reload(). The actual TDropDownList is in the MainLayOut.tpl file because it should be present on each page. But I have forgotten to use the following syntax:
Read more

Spam bots breaking through reCaptcha plugin

Ok once I had problems with spam bots commenting my posts with ads and links but I installed the reCaptcha plugin for wordpress and forgot about it. However these days I have problems again. This is one particular IP that is able to break through the validation! The IP is and I really would suggest to you to add it to your ban list. I will do it for sure! Today I had like 50 comments on a post, all got in approved !

CodeIgniter and IntelliSense in Eclipse PDT

For those that are not aware, IntelliSense is a feature of the Eclipse IDE, which allows us to quickly inspect the properties of an instantiated object of some type, function parameters, auto-completion, short description, if available and so on. This is incredibly handy when developing applications, no matter the programming language. When developing with CodeIgniter, due to the style the framework is written, the IntelliSense is not working.
Read more

CodeIgniter’s language management – improvement

Have you ever been annoyed by using the CodeIgniter’s language/localization functionality? I have been pissed by constantly repeating:

echo $this->lang->line('sample_label');

Read more

Prado and loading modules at runtime

Today I had big problems trying to load modules in Prado from the TPage, not using the application.xml. I had such a requirement for the globalization utility in our web application. So after hours of pain finaly I found the magic lines of code that allow this to happen. I am surprised that there was no entry in the documentation or in the forums :( .

Here is the code:
Read more