nei's blog
Error in Geographical Template - input is out of range - Doctrine / Symfony
Submitted by nei on Thu, 02/25/2010 - 14:55If you are using the getDistance method provided by Geogrphical Template in Doctrine and got this error:
500 | Internal Server Error | Doctrine_Connection_Pgsql_Exception
SQLSTATE[22003]: Numeric value out of range: 7 ERROR: input is out of range
You probably have the same problem that I got today..
Symfony Tips: Use the referer to customize messages on Symfony
Submitted by nei on Tue, 11/24/2009 - 11:10On symfony is a good idea to use the referer to costomize some messages, like this one below.
in template, you have to make a condition:
<?php if( $sf_request->getReferer() != '' ): ?>
The page <?php echo $sf_request->getParameter('page'); ?> was changed.
<?php else: ?>
Usando o case do bash
Submitted by nei on Fri, 11/20/2009 - 15:40Exemplo de código que demonstra a utilização do uso de CASE no bash.
#!/bin/bash
clear
echo "Diga o que deseja fazer:"
echo "1)Criar diretório"
echo "2)Criar arquivo"
echo "7)Sair do script e voltar ao console"
read n
case $n in
[1])
echo "Digite um nome para o diretório"
read nome1
touch "./"$nome1
;;
[2])
How to configure a symfony app on plesk 9.0.1
Submitted by nei on Thu, 08/20/2009 - 21:37I'm running plesk 9.0.1 and I configured my app on a subdomain, I did these steps to configure the app:
1) remove all default directories of domain
rm -rf /var/www/vhosts/example.com.br/subdomains/myapp/*
2) I put my files on document_root, like this
/var/www/vhosts/example.com.br/subdomains/myapp/conf,
/var/www/vhosts/example.com.br/subdomains/myapp/symfony
Symfony date widget limit 5 years forward/backward + admin generator
Submitted by nei on Thu, 08/20/2009 - 00:17I was creating a new project and I wanted to create on model Client a field called birthday as DATE field. I noticed that the admin generator form created a limited year's select to 5 forward and backward. I'm too change the format of field of mm/dd/yyyy to dd/mm/yyyy. How can I did it?
You need to override the formClass, like this:
class ClientForm extends BaseClientForm
{
How to create a cacheable xml-rpc request on Symfony
Submitted by nei on Wed, 07/15/2009 - 20:43Recently I needed to use the xml-rpc lib with symfony. I created a function to make cache of xml-rpc requests using the symfony's sfFileCache and it work good.
I'm using the xml-rpc library that you can get on http://phpxmlrpc.sourceforge.net/
public function callCache( $methodName, $params ){
// generated a key to cache file
How to get the lastinsertid Doctrine
Submitted by nei on Tue, 07/07/2009 - 16:45This example show how you can get the latest insert id on table continent.
$dbh = Doctrine_Manager::getInstance()->getCurrentConnection();
$sth = $dbh->prepare("INSERT INTO continent (created_at, updated_at) VALUES ( NOW(), NOW() )");
$sth->execute();
$conn = Doctrine_Manager::getInstance()->getCurrentConnection();
$conn->lastInsertId('continent_id');
How to update #Drupal with only one command
Submitted by nei on Fri, 07/03/2009 - 02:01Is very easy to update a drupal website. Since you follow the best practices of drupal development "Don't change the core code", ever use the override methods...
by example, to update of drupal 5.15 to 5.16.
cd /var/www/example.com/public_html
wget http://ftp.drupal.org/files/projects/drupal-5.16.tar.gz
tar -xzvf drupal-5.16.tar.gz --strip-component=1 --exclude=settings.php
Comentário de multiplas linhas no bash
Submitted by nei on Thu, 05/21/2009 - 20:21Para fazermos comentários de multiplas linhas no bash, utilizamos:
<
echo "PAR" ; # É PAR
else
echo "ÍMPAR" ; # É IMPAR
fi
COMENTARIO
Checking the compatibility of symfony with your web server configuration
Submitted by nei on Fri, 04/10/2009 - 16:27To check if your web server is compatible with symfony there is a useful script provided by Symfony team that test it for you.
download the file of svn repository.
# wget http://trac.symfony-project.org/browser/branches/1.2/data/bin/check_configuration.php?format=raw
**notice:** the symfony version is passed on url. In this case it's 1.2.
Now run the file with bellow command and test it accessing by browser and both must be OK.
