Difference between passing objects by reference and without in PHP

Quite often I here, that people don't understand, how to use variables by reference. PHP is not an exception. This will be a very short post in which I will try to make it clear.
First of all we will define simple object class A.

class A
{
	protected $foo;
	
	public function __toString()
	{
		return $this->getFoo();
	}
	
	public function setFoo( $foo )
	{
		$this->foo = $foo;
	}
	
	public function getFoo()
	{
		return $this->foo;
	}
}

Continue reading

How to fix Doctrine 1.2.4 Base models autoloading

I must say right away, that I don't know how correct this fix is, but it works for me. So in Doctrine ORM 1.2.4 after generating models I ran in a bit of a problem. So I fixed like that:
Find file vendor\doctrine\doctrine1\lib\Doctrine\Core.php
Next on line 1155 find this code:

$class = self::$_modelsDirectory . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';

            if (file_exists($class)){
                require $class;

                return true;
            }

And add this code after:

$class = self::$_modelsDirectory . DIRECTORY_SEPARATOR . 'generated' . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';

            if (file_exists($class)) {
                require $class;

                return true;
            }

This is it.

How to run Redis server as daemon

So I think, that those who will read this article probably know, what is Redis. For those who don't I can say shortly, that this is a software, that is used for storing some maped data ( key => value ) for faster usage. This software could help developers to make their applications by storing some primitive data like for example translations on multi-language webpage or other similar information. In this article I will shortly explain how to make your Redis server run as daemon, since making startup file for this in unix is not an option.
Continue reading

How to fix Java Error: “1723: There is a problem with this Windows Installer Package.”

Recently I encountered a Java error, that caught me completely unguard. First I tried to remove it through Add/Remove Programs on Windows, then I just deleted folders, but program didn't disappear. On contrary, I started to receive error displayed on image below.
Java 1723 error

So as I neither could delete program nor reinstall it.
Continue reading

How to create virtual host for app on Tomcat.

NB! I will say right away, that my Tomcat is running on Ubuntu Server 10.10 under VMWare Workstation 7.
So here it goes. Recently I installed YouTrack issue tracker on my local server, that runs on Tomcat. Very soon I got tired from typing every time (ip_address/webapp_name:port). So I looked up how to create a very simple VirtualHost for Tomcat.
Continue reading

Getting rid of Ubuntu old core versions in Grub

The reason for this post is hilarious. In my life time I installed and over installed Ubuntu for period of times, but every time I had to ask my buddy or Google about removing annoying old Ubuntu core versions from Grub configs and from /boot directory. Well, now I will describe those two simple steps for those who have same problem as I did.

Continue reading

Viva Las Vegas

Hey everyone. I think you will be stumped when you will see the title of this webpage and post about Las Vegas together and even a small, but beatiful song. Well, what can I say, I'm many-sided human) I heard this song on the radio and somehow all thoughts about being in Las Vegas came to me.
Hope you will enjoy this small post and great song.
For all who love the game.
Continue reading

Trying to get a hang of MVC

Yesterday I tried to make something that {would | could} be an example of MVC model. At least I thought that I understood how it should work correctly, but... Well in this post you can find a source code of what is done at the moment or you can fork it on http://codaset.com/jeserkin/elite-systems.
Please don't judge for my style of writing and file/folder architecture. It all should be as simple as possible. Maybe not too logical, but still.
Continue reading