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

Hard drive lost memory headaches on an old XP machine

Hello, it’s been a long time since my last post. I have been really busy … doing a lot of stuff … so you can expect some new stuff from me right away but please be patient. Now straight to the problem:

I have a old laptop (actually 3 years old Dell Inspiron 1520, well guarantee just dropped :( ) and I had problems with it for the last few months. I have partitioned the 140GB hard drive like C: – 20GB and D: – 120GB. That was decision some time ago so don’t judge me for that please. 6 months ago I noticed I am running low on C so I started trying optimize stuff, actually for that time I did a lot of tweaks like switching off hybernation, moving page file to D, reinstalling programs from C: to D: … and so on. Tried DSKCHK  with no success. Tried defragmenting it – again no success because of the low free space – less than 15%. Yesterday I got really pissed with this and downloaded a piece of software – WinDirStat and started checking where are the biggest files on C: … finally I concluded that I have used actually like 5 GB of memory, have 2 GB free and the rest is missing. Then I thought ok … what is left … system restore problem ?

Noo … I turned it off 6 months ago, it is not that. But then I tried turning it on, lowering the size of system restore, restarting the laptop, turning it of and guess what … 14GB free space. WTF!? For some reason last time when I have turned it off the laptop didn’t restarted normally and these 10GB have been held in the ‘System Volume Information’ folder.

PostgreSQL and network operators

I am working on a couple of projects that require the use of PostgreSQL and I really like dealing with it. Full of features that are sometimes quite usefull. One of them is the <<= network operator.

is contained within or equals – inet ’192.168.1/24′ <<= inet ’192.168.1/24′

This way one can check if an ip is in the range of a given network. Pretty simple, yeah! But I had the need to query ip address that are not in a specific network range :) . Well there is no opposite operator – at least I couldn’t find one. So what I did is is the following:


SELECT COUNT(*) FROM ips WHERE  CASE WHEN ip <<= inet '192.168.1/24' THEN false ELSE true END

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++)
{
	while(true)
	{
		try
		{
			$code = str_makerand();
			$codeID = $this->addItem(
				$this->tableNameCodes,
				array('code'),
				array($code)
			);

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

YouTube’s policy for inappropriate content and the embed function

Recently I noticed something in the way YouTube manages the videos flagged as inappropriate by some users. You know such videos you want to watch but you must be logged in. This way you accept and confirm you are older than 18 years. On my facebook profile I had a post with such a video – it is embed of the video as you know. And guess what – everyone can play it. It doesn’t matter it you are logged in or not. Here is the example: Read more

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

WAMP not working on localhost without active network connection

Until recently I experienced strange problems with my WAMP server. It is not working when my machine is not connected to the internet. That was a piece of mystery for me. Actually the problem is still unknown for me although I fixed it :) My problem was that I had set the WAMP’s option – ‘Put online’. It took me reaaaally long time until I figure that this was causing the problems. It has to do something with the configurations in the httpd.conf but I am still unclear which setting it is enabling/disabling. Found a lot of threads on the internet about this so thought to share it.

Update: I feel stupid but actually the problem was just in FF. I am still a bit confused why changing the setting of WAMP has effect on the way FF is working …

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

Yet another case for lawer’s opinion on UniCredit Bulbank’s queue

Today I was waiting for around 45 minutes in order to get to the cashier to pay my rent for the apartment.While waiting on the queue I had to be a witness of a conversation between the operator and a customer. They argued on the following situation:
Read more

Happy programmer’s day to all!

Happy programmer’s day to all of us coding all the day and drinking beer. Cheers! Should we count the 128th day of the year for another programmer’s day ? Here in Bulgaria it is not a holiday at all but anyway

+ 1 vote from me!