23 January 2011

Show errors in prestashop

From the installation directory of prestashop, edit the file config/config.inc.php and modify the following line :
@ini_set('display_errors', 'on');

use include in tpl files with smarty in prestashop modules

The smarty version included in prestashop seems to be slightly different than the offical release.

If you want to use the include instruction in a tpl file, you have to be aware of these limitations inside the instruction:
  • you cannot concat strings
  • you must use full path
One easy way I've found to achieve this is to use the following code in your .php file:
// Get the full path of the mytpl template
$smarty->assign('one_var', dirname(__FILE__).'/mytpl.tpl');
return $this->display(__FILE__, $this->name.'.tpl');
And the following code in your .tpl file:
{include file=$one_var}

20 January 2011

fix uptime and ls commands after coreutils install on synology DS211+ nas

After installing coreutils with ipkg, lots of system commands will be used from /opt/bin instead of /bin.
Most are working fine but some should be reverted. For example uptime seems completly broken and ls doesn't use color anymore.

I've fixed this issue with the following commands:

ln -sf /bin/ls /opt/bin/ls
ln -sf /usr/bin/uptime /opt/bin/uptime

19 January 2011

rc.d and init.d occurences in synology nas

(Took on a DS211+)

/usr/syno/etc/rc.d link to /usr/syno/etc.defaults/rc.d -> synology standard applications
/usr/local/etc/rc.d -> synology standard packages (*.spk)
/opt/etc/init.d -> optware applications (ipkg)
/etc/init.d -> linux standard applications

18 January 2011

quickly fix misencoded characters in mysql DB

If some accentuated characters of your database have been misencoded in the db, for example the french character é appears as é you can follow these steps to correct the accentuation :
  1. Export the db to an sql script
  2. Open file in notepad++
  3. In menu > encoding, select convert to ANSI
  4. In menu > encoding, select encode to UTF8
  5. Save the file
  6. Import the converted sql file in mysql

install ipkg on synology DS211+ NAS

Find out your processor version :
cat /proc/cpuinfo
Processor : Feroceon 88FR131 rev 1 (v5l)
BogoMIPS : 1589.24
Features : swp half thumb fastmult edsp
CPU implementer : 0x56
CPU architecture: 5TE
CPU variant : 0x2
CPU part : 0x131
CPU revision : 1

Hardware : Synology 6282 board
Revision : 0000
Serial : 0000000000000000
The Feroceon 88FR131 processor is also known as Marvel 6282

Installation of ipkg is done with the following steps :
cd /tmp
wget http://wizjos.endofinternet.net/synology/archief/syno-mvkw-bootstrap_1.2-7_arm-ds111.xsh
sh syno-mvkw-bootstrap_1.2-7_arm-ds111.xsh

Credit : 1 2

install redmine on ubuntu server 10.10 x64

Install Redmine, mySQL and Apache1
apt-get install redmine-mysql redmine mysql-server apache2
Link the redmine code to /var/www/redmine:
ln -s /usr/share/redmine/public /var/www/redmine
Install the apache2 passenger and fastcgi
apt-get install libapache2-mod-passenger libapache2-mod-fastcgi
Add this line to /etc/apache2/mods-available/passenger.conf (inside the IfModule directive):
PassengerDefaultUser www-data
Edit /etc/apache2/sites-enabled/000-default and add after the two first <directory> directives:
RailsBaseURI /redmine
PassengerResolveSymlinksInDocumentRoot on
Options Indexes ExecCGI FollowSymLinks
In /var/www/redmine/, create the file .htaccess, with exactly this content:
RewriteEngine On
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
Restart apache:
apache2ctl restart

Credit : 1

17 January 2011

CNAME in dnsmasq

In order to get working the CNAME directive in dnsmasq config, you need to configure the alias as FQDN

Use smtp.gmail.com as postfix relay

As some ISPs are blocking outgoing mail from home smtp server, we have to use a relay.
smtp.gmail.com is a good choice.

Here are the steps I've followed in order to configure postfix on ubuntu 10.10 to use gmail as a relay :

Install postfix
Choose Internet Site and keep the proposed next option
aptitude install postfix
configure postfix
cd /etc/postfix
nano main.cf
add the following lines at the end of the file :
relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl/passwd
smtp_sasl_security_options = noanonymous
(there is no need to comment out the same options that can be present before in the file as only the last ones are used)

create the file passwd
cd /etc/postfix/sasl/
nano /etc/postfix/sasl/passwd
insert this line, changing your own logon information
[smtp.gmail.com]:587 yourname@gmail.com:yourpassword
generate a db file that postfix can read
postmap passwd
give the right to postfix to read the two files
chmod +r /etc/postfix/passwd*
Generate the cacert.pem file
/usr/lib/ssl/misc/CA.pl -newca
I input the following information (but I don't think that any data input below are important):
Country Name (2 letter code) [AU]:BE
State or Province Name (full name) [Some-State]:Liege
Locality Name (eg, city) []:Liege
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Google
Organizational Unit Name (eg, section) []:Google
Common Name (eg, YOUR name) []:nicolas jolet
Email Address []:myaddress@gmail.com
Copy cacert.pem
cp demoCA/cacert.pem /etc/postfix/
EDIT 17/01/2011:
if you copy the content of the equifax certificate, this is also working and much more simple that the two previous steps
cat /etc/ssl/certs/Equifax_Secure_CA.pem > /etc/postfix/cacert.pem
Restart postfix deamon
/etc/init.d/postfix restart

I saw on some blogs/forums that you should add the ca cert of Equifax, but in my case, I didn't do it and this is working fine.

Credit : 1 2 3

16 January 2011

TXT_DB error number 2 failed to update database

As I m completly unaware of the openssl use, I only write here some observations I made :

If after the command :
openssl ca -out cert.pem -infiles req.pem
you got the following error message :
failed to update database
TXT_DB error number 2
This is probably because you have generated your own signing certificate with the same Common Name (CN) information that the CA certificate that you've generated before.

Simply input a different Common Name each time you are asked should do the trick.

Credit : 1