Sunday, December 14, 2008

Bug tracking system in PHP


MantisBT is a free popular web-based bugtracking system (feature list). It is written in the PHP scripting language and works with MySQL, MS SQL, and PostgreSQL databases and a webserver. MantisBT has been installed on Windows, Linux, Mac OS, OS/2, and others. Almost any web browser should be able to function as a client. It is released under the terms of the GNU General Public License (GPL).


It is freely available for download and customization at http://www.mantisbt.org

Tuesday, December 9, 2008

CodeLobster Free PHP Editor Supports Drupal/Smarty

CodeLobster is a free PHP Editor that supports PHP, HTML, JavaScript, CSS code highlighting and debugging. It has the following functionality.

• PHP, HTML, JavaScript, CSS code highlighting
• HTML autocomplete
• CSS autocomplete
• JavaScript Advanced autocomplete
• PHP Advanced autocomplete
• PHP Debugger
• SQL Autocomplete
• Preview in a browser
• Project manager
Drupal plug-in available
Smartyplug-in available


For more information and download this editor please visit http://www.codelobster.com

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.

Sunday, October 26, 2008

Upgrade Drupal 5.x website to Drupal 6.x version

Before upgrading from Drupal 5.x to Drupal 6.x version, we need to follow the below mentioned steps.

• Make a backup of all files and database. If anything goes wrong during upgrade process, than you can restore your Drupal 5.x web site. Must make a copy “Files” and “Site” Folder from the Drupal installation directory on your local system.

• If your site needs some particular module, ensure that those modules are available because few Drupal 5.x modules are still not available.


• Disable all contributed modules and set your Drupal site to default theme such as Garland or Bluemarine. You should upgrade modules and themes after you have completed core Drupal upgradation.

• Login in Drupal 5.x web site administrator panel. Navigate to modules setting page. Disable update_status module and uninstall this module.


• Again in Drupal 5.x admin panel, navigate to Logs -> Status report
If there is any problem fix it before upgrade.

• Upgrade all installed modules to its latest version available for Drupal 5.x


• Set your Drupal site to off-line mode. This can be done as follow. In Drupal admin panel Navigate to : Administrator -> Site Configuration -> Site maintenance -> select site status as off-line -> Save Configuration.

• Now using any FTP delete all files and folder from the Drupal installation directory.


• Download the latest version of Drupal 6.x from drupal.org. Unpack the files and upload it to the Drupal installation directory.

• Copy and paste “Files” and “Site” Folder from your backup to Drupal installation directory.


• If other system files such as .htaccess or robots.txt were customized, re-create the modifications in the new versions of the files using the backups.

• Run update.php by visiting http://www.example.com/update.php (replace www.example.com with your Drupal installation's domain name and path).


• Replace all custom old modules to their latest version compatible with version 6.x

• Re-enable custom and contributed modules and re-run update.php to update custom and contributed database tables.


• Upload any new theme for your site and enable it.

• Now you have updated your Drupal 5.x website to Drupal 6.x . Now login to admin panel and set your website status to online mode.

Drupal and Twitter

Twitter module provides twitter notification for new posts. Each user can use their own twitter account to post updates too, as well as have a custom format string.

For more information on twitter, see http://twitter.com/.

Galleria

Galleria is a javascript image gallery written in jQuery. It loads the images one by one from an unordered list and displays thumbnails when each image is loaded. It will create thumbnails for you if you choose so, scaled or unscaled, centered and cropped inside a fixed thumbnail box defined by CSS.

For more information please visit http://devkick.com/lab/galleria

Saturday, October 25, 2008

FTP of drupal.org

We can directly download modules from drupal.org even if the site is off-line. Navigate to ftp link ftp://ftp.drupal.org/pub/drupal/files/projects.

Host name : ftp.drupal.org
User name : anonymous
Password : your email_address.


After providing these informations just browse to the directory /pub/drupal/files/projects to download the contributed modules.

Sunday, October 19, 2008

HTML Validator

There is an interesting addon from firefox for validating the HTML pages, HTML Validator is a Mozilla extension that adds HTML validation inside Firefox and Mozilla. The number of errors of a HTML page is seen on the form of an icon in the status bar when browsing.

The extension can validate the HTML sent by the server or the HTML in the memory (after Ajax execution)

Thursday, October 16, 2008

CSS/JS Aggregator bug

In drupal, CSS Aggregation works almost with compressing the files like cleaning
out white spaces (just like a zip program ).

To reduce the count of request CSS Files can be combined.This can break your theming if you have not followed good coding guide lines. Especially while commenting the files good standards needs to be followed. Namespaces should not be overlapped.

On the other hand we can disable the option 'Optimize javascript' files in 'Javascript Aggregation' settings so that invalid comments in js files are not taken in to account and js flow will not get screwed up.

Sunday, October 12, 2008

Free email tracking for web pages

SpyPig is a simple email tracking system that sends you a notification email as soon as the recipient opens and reads your message. We have to specify an email address which we will notify by email when your message has been read. They will provide an tracking image in which we need to embed with the message body. whenever the recipient opens the email you will be notified immediately.

Friday, October 10, 2008

Performance improvement guidelines for drupal sites

In most of the web pages, less than 20% of the total response time is used to retrieve the HTMl document. That means the other 80+% is used to process what's in the HTML file: CSS, JS, images, videos. And in many cases, that number is even higher.

In order to improve the performance on drupal sites, drive in to the following procedures. This includes both the server side caching and YSlow for Firebug recommendations.

Drupal Side

Ø Enable the CSS Aggregation and JS Aggregation from the drupal administrators settings (In drupal5 JS Aggregator is a separate module - http://drupal.org/project/javascript_aggregator).

o If js errors are encountered, disable the option ‘optimize js files’ from your drupal settings or make sure all the comments in the JS files are valid.

o After enabling the ‘CSS Aggregator’, if the theme gets messed up make sure that the CSS files are commented properly.

Ø Activate the memcache (http://www.danga.com/memcached/) by installing this service. Memcache is intended for use in speeding up dynamic web applications by alleviating database load.

o Install the drupal-memcache module in drupal5 as a module (http://drupal.org/project/memcache).

o After installing this module, add the following lines in settings.php

§ $conf = array(
'cache_inc' => './sites/all/modules/memcache/memcache.inc',
// or
// 'cache_inc' => './sites/all/modules/memcache/memcache.db.inc',
);

o This will override the default cache file (ie) cache_set() and cache_get() functional calls will get data from the memcache server and not in the drupal cache table. So number of db calls and query time will be reduced.

Ø If the information is retrieved from views, avoid the usage of calling views_view() for many times and store the output of the views in cache by using cache_set(). Clear the cache periodically based on the view type and avoids showing the static information.

Ø Enable the ‘page caching’ from drupal settings so that anonymous users will be benefited and re-construction of web page will be avoided.

Apache Side

Ø Add an expires headers for all the files types like CSS, Images etc.

o Changing the future date for the Expires headers is easy enough: simply edit your .htaccess file. Your Apache server must also have mod_expires installed; this is available by default on most servers.

Ø Add the gzip component so that web pages are written to the cache in GZIPped form.

o Following lines has to be written in .htaccess file for gzip

§ “AddOutputFilterByType DEFLATE text/css application/x-javascript”.

Ø An ETag uniquely identifies a file, and is used to verify if the file in the browser's cache matches the file on the server..

o Following lines has to be written in .htaccess file for disable etag

§ “FileEtag none”.

References :
1. http://wimleers.com/article/improving-drupals-page-loading-performance
2. http://video.yahoo.com/watch/1040890/3880720