Saturday, November 29, 2008

XAJAX

XAJAX Offers an open source PHP class library that allows to create Ajax applications using HTML, CSS, JavaScript, and PHP.

It is an AJAX library for PHP that allows you to create AJAX functionality without writing javascript. It’s very functional and fairly simple to use.

For more information please visit http://www.xajaxproject.org/.

It can be easily integrated with drupal and the relevant information will be found at http://www.shamit.org/dpal/node/76

Sunday, November 23, 2008

STORM : Drupal Project management

STORM (SpeedTech Organization and Resource Manager) is a new project management application for Drupal platform versions 5 and 6. It uses only Drupal core features and doesn't rely on any external modules. The objective is to provide a complete crm and project management application both for freelancers and small-medium size companies. At now it provides the following features :

* Attributes : to manage the different list of values used in STORM, like : tasks status, countries, currencies and so on
* Organizations : the companies or individual stakeholders of your projects
* Projects : your projects. Every project can have multiple tasks hierarchically nested to build a WBS
* Tasks : the parts that compose a project
* Tickets : every ticket can be associated with an organization, project and task
* Timetrackings : where you can register your activities on an organization, project, task or ticket
* People : organizations contacts
* Permission control : a fine grained permission control permits to share the data with other users and organizations
* Reporting : a simple and themeable support for reporting (with optional multilingual support)
* Notes : a note can be associated to an organization, project and task
* Knowledgebase : simple container to organize your knowledge
* Invoices : an invoice must have a customer and can be linked to a project
* Expenses : to keep track of both internal and for customers expenses

This could be downloaded from http://drupal.org/project/storm

Saturday, November 22, 2008

CodeIgniter

CodeIgniter is an Application Development Framework - a toolkit - for people who build web sites using PHP. Its goal is to enable you to develop projects much faster than you could if you were writing code from scratch, by providing a rich set of libraries for commonly needed tasks, as well as a simple interface and logical structure to access these libraries. CodeIgniter lets you creatively focus on your project by minimizing the amount of code needed for a given task.

CodeIgniter is right for you if:

* You want a framework with a small footprint.
* You need exceptional performance.
* You need broad compatibility with standard hosting accounts that run a variety of PHP versions and configurations.
* You want a framework that requires nearly zero configuration.
* You want a framework that does not require you to use the command line.
* You want a framework that does not require you to adhere to restrictive coding rules.
* You are not interested in large-scale monolithic libraries like PEAR.
* You do not want to be forced to learn a templating language (although a template parser is optionally available if you desire one).

For more information please visit http://codeigniter.com/

Sunday, November 16, 2008

PHP Optimization-Best practices

• Use single quotes for strings

o When you surround a PHP string in double quotes, it is subsequently parsed by the PHP interpreter for variables and special characters, such as "\n". If you just want to output a basic string, use single quotes! There is a marginal performance benefit, since the string does not get parsed.

o “print” is slower than “echo”, putting variables inline in a string is slower than concatenating them, and concatenating strings is slower than using comma-separated echo values! Not only does not-inlining your variables give you a performance boost, but it also makes your code easier to read in any editor that has syntax highlighting (your variables will show up in nice colors).
echo "Hi my name is ",$a,". I am ",$b; //Good
print "Hi my name is $a. I am $b"; //Bad

• Use single-quotes around array indexes

o PHP considers the unquoted index as a "bare" string, and considers it a defined constant. When it can't find a matching symbol for this constant in the symbol table however, it converts it to a real string, which is why your code will work. Quoting the index prevents this constant-checking stuff, and makes it safer in case someone defines a future constant with the same name.

$arr['name'] //Good
$arr[name] //Bad

• Don't use short open tags.It can cause conflicts with XML parsers, and if you ever distribute code, it's going to annoy the heck out of people who have to start modifying their PHP ini directives to get it to work.

• Don't use regular expressions if you don't need to.

o If you're doing basic string operations, stay away from the preg and ereg function groups whenever possible. str_replace is much faster than preg_replace, and strtr is even faster than str_replace.

• Don't use functions inside a loop declaration.

o If you use a function like count() inside a loop declaration, it's going to get executed at every iteration! If your loop is large, you're using a lot of extra execution time.
$count = count($array);
for($i = 0; $i < $count; $i++) {} //Good
for ($i = 0; $i < count($array); $i++) {} //Bad

• Never rely on register_globals or magic quotes.

• Always initialize your variables
o PHP will automatically create a variable if it hasn't been initialized, but it's not good practice to rely on this feature. It makes for sloppy code, and in large functions or projects can become quite confusing if you have to track down where it's being created. In addition, incrementing an uninitialized variable is much slower than if it was initialized.

• Validate and sanitize your inputs
o Always use isset() or empty() before checking for type because is_array() is costly and could waste many valuable cpu-cycles if the variable isn't even set in the first place. Short-circuit is your best friend when it comes to efficient programming.
if (isset($myVar) && is_array($myVar)) {} //Good
if ($myVar) { } //Bad

• It’s better to use switch case statements than multi if, else if, statements.

• Cache as much as possible. Use memcached - memcached is a high-performance memory object caching system intended to speed up dynamic web applications by alleviating database load. OP code caches are useful so that your script does not have to be compiled on every request.

• mod_gzip which is available as an Apache module compresses your data on the fly and can reduce the data to transfer up to 80%.

• Do NOT use SQL wildcard select. eg. SELECT *.

• Possibly use “strncasecmp”, “strpbrk” and “stripos” instead of “regex.”.

• Just declaring a global variable without using it in a function also slows things down (by about the same amount as incrementing a local var). PHP probably does a check to see if the global exists.