Project Management Open Source Software

Thursday, April 22nd, 2010 | Different Thoughts, Web development | Comments Off

There is almost an year since working with qdpm, http://qdpm.net/, which is a great tool for project management, however I wanted something more complete and if possible that had svn support for the projects.

update: qdpm supports gantt charts from version 5.5

Here is what I found:

1. Clockingi.com, http://www.clockingit.com/  has nice graphical reports, gantt charts and svn support

2. Codeni, http://www.codendi.com from XEROX, supports svn/cvs repository browsing and gantt charts, seems a complex and mature product

3. Collabtive, http://collabtive.o-dyn.de/, it’s a simple, lightweight project management too, useful for a very small team or a freelancer

4. project-open, http://www.project-open.org/

5. endeavour, http://endeavour-mgmt.sourceforge.net, you can check it’s features here: http://endeavour-mgmt.sourceforge.net/features1.html

6. Redmine, http://www.redmine.org/, gantt charts, integrations with SVN, CVS, Mercurial, etc.. written in Ruby on Rails

Tags:

Jquery Regex Validation

Wednesday, February 17th, 2010 | Web development | Comments Off

A quick post about validating anything you want using regex. I used it in a project that created forms on the fly, so validations like email, numbers and so on wasn’t so simple (I couldn’t do it by just adding the validation as a class: class=”email”)

so first step is adding what we need before the </head>:

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.validate.pack.js">

now just after the above code we add our regex method:

<script type="text/javascript">
$.validator.addMethod(
 "regex",
 function(value, element, regexp) {
 var check = false;
 var re = new RegExp(regexp);
 return this.optional(element) || re.test(value);
 },
 "Please check your input"
);
</script>

and the final thing is ading the validation we need – you can use php to add them from the database for instance:

<script type="text/javascript">
$(document).ready(function(){
$("#myFieldId").rules("add", {regex: "^(0|[1-9][0-9]*|[1-9][0-9]{0,2}(,[0-9]{3,3})*)$"});
})
</script>

How google can penalize your website because of adsense

Sunday, February 14th, 2010 | Google | Comments Off

Lesson learned – sometimes google can penalize your website because incorrect use of adsense.

This storry started a while back when I begun adding adsense on one of my websites where I suspected it is not allowed (it’s a website on which people can upload school content and such).

Everything was fine for a while – about 4 months, I got a little amount of money too when suddenly the website dropped from the search engines. I thought it was because of duplicate content or because of the too many pages the site had, which was strange but I had no clue.

So I kept my website simple removing all pages that were not important, I even removed the adsense from some of the pages including first page because anyway I was not making any money anymore.

After 8 months guess who was back?… my website :) – I was happy for 1 month until I received another payment from adsense (cumulated with another website) – just after payment was confirmed the website was down again from the search engines, so now I suspected the cause: I removed all adsense from the website, after 2 more months my website was back again!!!

In conclusion I think google has a swith for it’s personnel, including the google adsense staff who can shot your website into his legs bringing it down for a while.

Optimize your hosting server

Saturday, December 19th, 2009 | Linux | 1 Comment

A quick info of how you can optimize your hosting server if you are using a LAMP (Linux Apache Mysql PHP) environment.

I am keeping the info for reference, I will also try to update it but please not that’s not a complete list. Please comment if you have any opinions

1. use php as a fcgi module not as a dso module for apache
2. compile apache with mpm (Multi-Processing Module) worker that is capable to serve a large number of requests with less system resources than a process-based server.
3. use php eaccelerator it’s proven to be faster than apc and other cache systems
tweak it based on http://eaccelerator.net/wiki/Settings

that’s basically it :)

now some configuration parameters:
1. don’t use SymLinksIfOwnerMatch in your httpd.conf a lstat system call is made for each directory and it’s not cached
2. Tune MinSpareServers and MaxSpareServers so that Apache need not spawn more than 4 child processes per second (Apache can spawn a maximum of 32 child processes per second). When more than 4 children are spawned per second, a message will be logged in the ErrorLog.

to be continued…

Error while loading shared libraries: libmm.so.14

Saturday, December 19th, 2009 | Linux | Comments Off

As the title say, that’s an error message which I received when trying to compile a php version with mm as a ./configure option.

fixing it is as easy as checking debug.log in your php source directory, searching where the php is looking for libraries (mine was in /usr/local/lib64) and than just creating a symlink for libmm.so.14 to /usr/local/lib64

Don’t have libmm at all? Go to http://www.ossp.org/pkg/lib/mm/ and install the library.

Update: apparently in php.ini you need to uncomment the session save path directive as otherwise the default path is / which triggers a permission error. Because of this the mm session handler does not get registered with php

An apache php fastcgid suexec cpanel story

Sunday, December 13th, 2009 | Linux | Comments Off

I wanted to get fastcgid running on cpanel/whm, so I went to easyApache and selected to compile apche with fastcgid support and php with fastcgi support, but guess what – it wasn’t working! they just ignored the settings and php was compiled without fastcgi in it.

So back to the beggining, dreaming of my lost time figuring out what the heck was wrong with whm/cpanel/easyapache I turned to plan B.

I recompiled apache still with easyapache from whm but without php. Further more I also choosed MPM worker module to improve the way static content is served. (!!! mpm worker is not compatible with PHP as an apache module)

Next step I compiled php from source – see my other article regarding compiling php from source and checking what I used as ./configure command.

Note: if you don’t have mod_fcgid module installed do this command in the directory you extracted the mod_fcgid archive that you got from apache website:
./configure.apxs
make
make install

I went to httpd.cnf -> on my system was on /usr/local/apache/conf and added the following lines:


AddHandler fcgid-script .php
Options +ExecCGI
FcgidWrapper /home/user/php-wrapper .php
Order allow,deny
Allow from all

Now I create the wrapper that will execute the php:

cd /home/user
sudo vi php-wrapper

add this inside the file:

#!/bin/sh
exec /usr/local/php-5.3.2-fcgi/bin/php-cgi

then, some security aspects (it’s required by suexec and it’s nice organizing things a little):

sudo chown user.nobody php-wrapper
sudo chmod 550 php-wrapper
cd ..
sudo chown -R user.nobody user/public_html
sudo chmod -R 0750 user/public_html

as a real world example:
chown alex.nobody /home/alex/php-wrapper
chmod 550 /home/alex/php-wrapper
chown -R alex.nobody /home/alex/public_html
chmod -R 0750 /home/alex/public_html
chmod -R g+s /home/alex/public_html

!Make sure you change the path of the fcgid wrapper to fit your php directory you have just compiled.

make sure suexec is enabled (it’s installed by default in whm, and you can enabled from php&sexec configuration section)
Restart apache and that’s it, or should I say… good luck :)

Note: you need to learn how to optimize fcgid config variables and because mpm worker was also installed, it’s corresponding configuration variables as well. But till you do, the default will be just fine.

Please study the instructions and make sure you understand them before breaking a live server

Install php from source – custom path

Sunday, December 13th, 2009 | Linux | Comments Off

Hey guys,

Recently I wanted to give php 5.3.1 a go but without interferring with my current setup, so I choosed to run it as fcgi.
In order to do that I wanted to compile php from source, enabling the modules I needed (gd with jpg support), bmath, pdo, pdo_mysql (for magento) and so on

here we go:
1. go to php site and download your version
2. upload to your server and unarchive it somewhere :)
3. go using putty or something similar to where are the files extracted, enter the source directory
4. I used this command, change it per your needs:
./configure –enable-bcmath –enable-calendar –enable-fastcgi –disable-cli –enable-ftp –enable-gd-native-ttf –enable-libxml –enable-magic-quotes –enable-mbstring –enable-soap –enable-sockets –prefix=/usr/local/php-5.2.13-fcgi –with-curl=/opt/curlssl/ –with-jpeg-dir=/usr/lib –with-jpeg –with-png-dir=/usr/lib –with-libdir=lib64 –with-gd –with-mm –with-mcrypt=/opt/libmcrypt/ –with-mysql=/usr –with-mysql-sock=/var/lib/mysql/mysql.sock –with-mysqli=/usr/bin/mysql_config –with-openssl=/usr –with-openssl-dir=/usr –with-zlib –with-zlib-dir=/usr –enable-pdo –with-pdo-sqlite –with-sqlite –with-pdo-mysql=/usr –with-pdo-sqlite –enable-zend-multibyte –with-freetype-dir=/usr –with-gettext –with-ttf –enable-force-cgi-redirect –enable-sysvsem –enable-sysvshm
5. make
6. make install

make sure you rename and copy the development php.ini to the lib/php.ini

Install pdo_mysql – no recompiling php

Sunday, December 13th, 2009 | Linux | 1 Comment

I googled till 4 AM to check how can I enable/install pdo_mysql for magento without the need to reinstall php – as all posts pointed I should do
finally I get it working

From here I started:
1. I already had pdo
2. I hadn’t pdo_mysq;

so back to work (as root):
1. Download PDO_MYSQL from http://pecl.php.net/package/PDO_MYSQL
2. upload it to your server
3. run export PHP_PREFIX="/usr/local/php/"
4. run $PHP_PREFIX/bin/phpize
4. run ./configure '--with-pdo-mysql=shared,/usr' !! /usr was where my mysql was installed (not where the data of mysql are!)
5. make
6. make install
7. in your php.ini
8. add
extension_dir = "/usr/local/php/extensions/no-debug-non-zts-20060613"
extension=pdo_mysql.so

9. restart apache

Install eaccelerator from scratch – Centos

Sunday, December 13th, 2009 | Linux | Comments Off

1. download the source code and upload it to your server
2. execute
export PHP_PREFIX="/usr/local/php/"
where /usr/local/php/ is my path to where php is installed
3. $PHP_PREFIX/bin/phpize
4. ./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config
5. make
6. make install
7. now go to php.ini and include this code:
zend_extension="/usr/local/php5.2.12-fcgi/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="128"
eaccelerator.cache_dir="/tmp/eacc-php5.2.12-fcgi"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter="*.php"
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="7200"
eaccelerator.shm_prune_period="7200"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="8"
eaccelerator.keys = "shm"
eaccelerator.sessions = "shm"
eaccelerator.content = "shm"

make sure you change the extension path above to fit your php extension directory
8. restart apache

Overlength date field error in prestashop

Saturday, December 12th, 2009 | Web development | Comments Off

Recently I got this error when trying to send emails in prestashop.
An email was bouncing back and it contained the following message:
This message has been rejected because it has
an overlength date field which can be used
to subvert Microsoft mail programs

After a lot of headaches and a cofee :) I manage to detect what was wrong:
Presta uses in the email class a variable $templateVars
this was like:

$templateVars = array(
‘{date_facturare}’ =>
‘Nume Firma: ‘.$invoice->company.’<br>’.
‘Cod fiscal: ‘.$invoice->tax_code.’<br>’.
‘Registrul Comertului: ‘.$invoice->reg_data.’<br>’.
‘IBAN: ‘.$customer->iban.’<br>’,
‘CNP: ‘.$invoice->cnp.’<br>’,
‘{firstname}’ => $customer->firstname,
‘{lastname}’ => $customer->lastname, …

However the problem was because of a , instead of .
'IBAN: '.$customer->iban.'<br>',
should have been:
'IBAN: '.$customer->iban.'<br>'.

Because of the wrong “,”, $templateVars[0] was taking a long value and apparently Swift Mailer was appending it to the header date of the email hence the error with the overlength date field.

Tags: ,