Tag Archives: php

Cakephp – Never empty password in auth component

Replace if (isset($data[$model->alias][$this->fields[‘username’]]) && isset($data[$model->alias][$this->fields[‘password’]])) {

with

if (isset($data[$model->alias][$this->fields[‘username’]]) && !empty($data[$model->alias][$this->fields[‘password’]])) {

In the cake/libs/controller/components/auth.php file

Cakephp Paginate – How to change separator “|”

In your view you just do something like this:

Paginator->prev('<'disabled'));?>
Paginator->numbers(array('separator'=>''));?>
Paginator->next(__('Next', true) . ' >>', array(), null, array('class' => 'disabled'));?>

PHP_Incomplete_Class problem

If you save an object in a session and you want to use it in another page you will receive that error.

To avoid this the class declaration has to be available before you call session_start().

Top 10 Coolest PHP name functions

10. overload
9. reset
8. end
7 .sleep
6. __destruct
5. empty
4. explode

3. chop

2. exit

1. die

Seems that PHP is a melancolic and sad language…

Eclipse Helios comming soon

When Eclipse Galileo was released I thought that the next version of Eclipse will be in the next 4 years. Fortunately, I’m wrong and the new version called Eclipse Helios will be released for 23 june.

http://www.eclipse.org/eclipse/development/plans/freeze_plan_3.6.php

http://www.blogcatalog.com/directory/technology/computers/software/programming/

Turpial – Twitter client that works in Ubuntu Lucid

I try gwibber (the default twitter client that comes with Ubuntu Lucid) and I don’t like the UI that they proposed.  I also tried the echofon firefox extension but I wanted something integrated with the OS.

I will give it a try to Turpial it seems lighter and more intuitive.

http://turpial.org.ve/downloads/

the deb package

https://launchpad.net/~effie-jayx/+archive/turpial/+files/turpial_1.0-0ubuntu1_all.deb

Extend sudo timeout in Ubuntu

In a terminal window:

sudo visudo

Edit the file and add

Defaults timestamp_timeout = 45

This means extending the timeout to 45 minutes

Enable variable highlighting with Eclipse

There is a great functionality in Netbeans 6.8 that comes by defaut: You select a variable and then all variables in the same page are highlight:

You can enable this behavior in  Eclipse Ganymede, just go to this config page

Window->Preferences->General->Text Editors

And then change the “When mouse into hover” option  to “Enrich on click”

Install Xdebug in Ubuntu Lucid Lynx

#in order to install phpsize because the pecl will need this

sudo apt-get install php5-dev

sudo apt-get install php-pear # in order to install xdebug

sudo pecl install xdebug

sudo apt-get install php5-xdebug

Edit your php.ini configuration and edit this settings

display_errors on

html_errors=on

Print a phpinfo() and check if xdebug is correctly installed. You can use the php -v command

Install Apache2 + PHP5 + MySQL + Eclipse+ PHPEclipse + Mercurial +SVN in Ubuntu 10.04 Lucid Lynx

This is sooo useful when you have a new laptop/PC is a must for every true developer…

# Instalando el servidor Apache version 2
sudo apt-get install apache2

# PHP5
sudo apt-get install php5

# Servidor MySQL
sudo apt-get install mysql-server-5.1

# Módulo de apache para mysql
sudo apt-get install libapache2-mod-auth-mysql php5-mysql

sudo apt-get install phpmyadmin  # opcional

sudo apt-get install mysql-query-browser  # opcional ( MYSQL query browser)

sudo apt-get install vim # an useful editor

sudo apt-get install meld # a freaking easy merge tool

sudo apt-get install openjdk-6-jre # yeah sun-java6-jre is  deprecated now in Lucid at least in the beta

sudo apt-get install mercurial # of course

Download Eclipse Ganymede not Galileo

http://www.eclipse.org/ganymede/

Note: There are some issues with Eclipse Galileo, when you trying to install  *obligatory* plugins like PHPEclipse, Mercurial or SVN, simply it does not work.

Add this plugins:

PHPEclipse

http://update.phpeclipse.net/update/stable/1.2.x/

Mercurial

http://www.vectrace.com/eclipse-update/

SVN

http://subclipse.tigris.org/update_1.4.x

At least but no last do a :

hg clone https://chamilo.googlecode.com/hg/ chamilo

To get your last Installation of Chamilo 😉

And for turn an SVN/Mercurial project to a PHP project in order to have the inspect function feature edit your .project file and add this:

<buildSpec>
<buildCommand>
<name>net.sourceforge.phpeclipse.parserbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>net.sourceforge.phpeclipse.phpnature</nature>
</natures>

Here the short way for install the deb packages:

sudo apt-get install apache2 php5 mysql-server-5.0 libapache2-mod-auth-mysql php5-mysql phpmyadmin  mysql-query-browser vim meld openjdk-6-jre mercurial vim

If you have some issues with the openjdk6-jre installation you may try installing this version.