Wednesday, November 26, 2008

Saturday, November 22, 2008

Five Good Features About Drupal 6 Than Previous Versions.

1.Performance. The Drupal core is much more efficient in Drupal 6 than in previous versions. Caching is employed much more in the theming process than formerly, so in serving a page time is not wasted looking for theme files and functions that don’t exist. The module system is much leaner, with files being loaded on demand rather than willy-nilly.
2.Schema module. There’s more abstraction available in the database layer, with the addition of the new Schema module which allows module developers to manipulate tables at a higher level.
3.AHAH Support. The forms API now includes AHAH support, which is either a subset of AJAX or a close cousin, depending on what book you read. Either way, it makes the creation of enhanced user interfaces much easier.
4.Improvements to CCK. The Content Construction Kit module has been greatly improved in Drupal 6, and the administration of fields and widgets is much easier as a result. One unfortunate effect however is that due to the API changes many CCK extensions developed for Drupal 5 have not been ported as yet at the time of writing. Another complaint is that the CCK API is still not well-documented or easy to write for.
5.Improvements to Views. The latest version of the Views module includes a new administration UI that - leaving aside a few idiosyncrasies - is a joy to work with. New views of data can be built and customized a lot more rapidly than formerly. If I have any complaint it is that field names in the data passed to row templates are still rather overlong and weird: the ability to give these short, sensible, aliases would be very helpful.
To summarise, Drupal 6 is in general a considerable improvement over its predecessors. However, the fact that a significant number of useful contributed modules are not yet available in usable form for production purposes is disappointing.

Baby Break Dance

What is value of 500 RS for different people?

Monday, November 10, 2008

Tips for Mysql

1. use the explain command
Use multiple-row INSERT statements to store many rows with one SQL statement.

The explain command can tell you which indexes are used with the specified query and many other pieces of useful information that can help you choose a better index or query.

Example of usage: explain select * from table

explanation of row output:
* table—The name of the table.
* type—The join type, of which there are several.
* possible_keys—This column indicates which indexes MySQL could use to find the rows in this table. If the result is NULL, no indexes would help with this query. You should then take a look at your table structure and see whether there are any indexes that you could create that would increase the performance of this query.
* key—The key actually used in this query, or NULL if no index was used.
* key_len—The length of the key used, if any.
* ref—Any columns used with the key to retrieve a result.
* rows—The number of rows MySQL must examine to execute the query.
* extra—Additional information regarding how MySQL will execute the query. There are several options, such as Using index (an index was used) and Where (a WHERE clause was used).
2. use less complex permissions

The more complex your permissions setup, the more overhead you have. Using simpler permissions when you issue GRANT statements enables MySQL to reduce permission-checking overhead when clients execute statements.
3. specific mysql functions can be tested using the built-in “benchmark” command

If your problem is with a specific MySQL expression or function, you can perform a timing test by invoking the BENCHMARK() function using the mysql client program. Its syntax is BENCHMARK(loop_count,expression). The return value is always zero, but mysql prints a line displaying approximately how long the statement took to execute
4. optimize where clauses
* Remove unnecessary parentheses
* COUNT(*) on a single table without a WHERE is retrieved directly from the table information for MyISAM and MEMORY tables. This is also done for any NOT NULL expression when used with only one table.
* If you use the SQL_SMALL_RESULT option, MySQL uses an in-memory temporary table
5. Run optimize table

This command defragments a table after you have deleted a lot of rows from it.
6. avoid variable-length column types when necessary

For MyISAM tables that change frequently, you should try to avoid all variable-length columns (VARCHAR, BLOB, and TEXT). The table uses dynamic row format if it includes even a single variable-length column.
7. insert delayed

Use insert delayed when you do not need to know when your data is written. This reduces the overall insertion impact because many rows can be written with a single disk write.
8. use statement priorities
* Use INSERT LOW_PRIORITY when you want to give SELECT statements higher priority than your inserts.
* Use SELECT HIGH_PRIORITY to get retrievals that jump the queue. That is, the SELECT is executed even if there is another client waiting.
9. use multiple-row inserts

Use multiple-row INSERT statements to store many rows with one SQL statement.
10. synchronize data-types

Columns with identical information in different tables should be declared to have identical data types so that joins based on the corresponding columns will be faster.

Wednesday, November 5, 2008

CakePHP - For robust web applications

CakePHP is a framework for PHP that provides an extensible architecture for developing, maintaining, and deploying applications. Through which it will create forms by itself based on the columns we specify in database. Live Demo where cakePHP integrated with modal dialog box. For futher information please visit CakePHP.

Tuesday, November 4, 2008

Steps For Installing & Configuring Apache PHP and MySQL

Installing Apache
Installing apache is easy if you download the Microsoft Installer ( .msi ) package. Just double click on the icon to run the installation wizard. Click next until you see the Server Information window. You can enter localhost for both the Network Domain and Server Name. As for the administrator's email address you can enter anything you want.I'm using Windows XP and installed Apache as Service so everytime I start Windows Apache is automatically started.


Click the Next button and choose Typical installation. Click Next one more time and choose where you want to install Apache ( I installed it in the default location C:\Program Files\Apache Group ). Click the Next button and then the Install button to complete the installation process.To see if you Apache installation was successful open up you browser and type "http://localhost" in the address bar. You should see something like this :By default Apache's document root is set to htdocs directory. The document root is where you must put all your PHP or HTML files so it will be process by Apache ( and can be seen through a web browser ). Of course you can change it to point to any directory you want. The configuration file for Apache is stored in C:\Program Files\Apache Group\Apache2\conf\httpd.conf ( assuming you installed Apache in C:\Program Files\Apache Group ) . It's just a plain text file so you can use Notepad to edit it.

For example, if you want to put all your PHP or HTML files in C:\www just find this line in the httpd.conf :

DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs"

and change it to :

DocumentRoot "C:/www"

After making changes to the configuration file you have to restart Apache ( Start > Programs > Apache HTTP Server 2.0.50 > Control Apache Server > Restart ) to see the effect.
Another configuration you may want to change is the directory index. This is the file that Apache will show when you request a directory. As an example if you type http://www.php-mysql-tutorial.com/ without specifying any file the index.php file will be automatically shown.
Suppose you want apache to use index.html, index.php or main.php as the directory index you can modify the DirectoryIndex value like this :

DirectoryIndex index.html index.php main.php

Now whenever you request a directory such as http://localhost/ Apache will try to find the index.html file or if it's not found Apache will use index.php. In case index.php is also not found then main.php will be used.

Installing PHP

First, extract the PHP package ( php-4.3.10-Win32.zip ). I extracted the package in the directory where Apache was installed ( C:\Program Files\Apache Group\Apache2 ). Change the new created directory name to php ( just to make it shorter ). Then copy the file php.ini-dist in PHP directory to you windows directory ( C:\Windows or C:\Winnt depends on where you installed Windows ) and rename the file to php.ini. This is the PHP configuration file and we'll take a look what's in it later on.

Next, move the php4ts.dll file from the newly created php directory into the sapi subdirectory. Quoting from php installation file you can also place php4ts.dll in other places such as :

* In the directory where apache.exe is start from ( C:\Program Files\Apache Group\Apache2 \bin)
* In your %SYSTEMROOT%\System32, %SYSTEMROOT%\system and %SYSTEMROOT% directory.
Note: %SYSTEMROOT%\System32 only applies to Windows NT/2000/XP)
* In your whole %PATH%

Modifying Apache Configuration

Apache doesn't know that you just install PHP. We need to tell Apache about PHP and where to find it. Open the Apache configuration file in C:\Program Files\Apache Group\Apache2\conf\httpd.conf and add the following three lines :

LoadModule php4_module php/sapi/php4apache2.dll
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

The first line tells Apache where to load the dll required to execute PHP and the second line means that every file that ends with .php should be processed as a PHP file. You can actually change it to anything you want like .html or even .asp! The third line is added so that you can view your php file source code in the browser window. You will see what this mean when you browse this tutorial and click the link to the example's source code like this one.

Now restart Apache for the changes to take effect ( Start > Programs > Apache HTTP Server 2.0.50 > Control Apache Server > Restart ) . To check if everything is okay create a new file, name it as test.php and put it in document root directory ( C:\Program Files\Apache Group\Apache2\htdocs ). The content of this file is shown below.

phpinfo();
?>

phpinfo() is the infamous PHP function which will spit out all kinds of stuff about PHP and your server configuration.

Installing MySQL

First extract the package ( mysql-4.0.18-win.zip ) to a temporary directory, then run setup.exe. Keep clicking the next button to complete the installation. By default MySQL will be installed in C:\mysql.

Open a DOS window and go to C:\mysql\bin and then run mysqld-nt --console , you should see some messages like these :
C:\mysql\bin>mysqld-nt --console
InnoDB: The first specified data file .\ibdata1 did not exist:
InnoDB: a new database to be created!
040807 10:54:09 InnoDB: Setting file .\ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
040807 10:54:11 InnoDB: Log file .\ib_logfile0 did not exist: new to be created

InnoDB: Setting log file .\ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
040807 10:54:12 InnoDB: Log file .\ib_logfile1 did not exist: new to be created

InnoDB: Setting log file .\ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
040807 10:54:31 InnoDB: Started
mysqld-nt: ready for connections.
Version: '4.0.18-nt' socket: '' port: 3306

Now open another DOS window and type C:\mysql\bin\mysql

if your installation is successful you will see the MySQL client running :

C:\mysql\bin>mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.18-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

Type exit on the mysql> prompt to quit the MySQL client.

Now let's install MySQL as a Service. The process is simple just type mysqld-nt --install to install the service and net start mysql to run the service. But make sure to shutdown the server first using mysqladmin -u root shutdown

C:\mysql\bin>mysqladmin -u root shutdown

C:\mysql\bin>mysqld-nt --install
Service successfully installed.

C:\mysql\bin>net start mysql

The MySQL service was started successfully.


C:\mysql\bin>mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.18-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>.

Sunday, November 2, 2008

Drupal Uses OOPS Concepts Or Not ?

“Drupal” - One of the most popular open sources content management system and framework built with PHP language, summary is - Drupal doesn’t use a single Class in its code base. Whole Drupal code base is based on just functions. As PHP, with which programming language Drupal itself is built, is also implementing many powerful OPP features, but Drupal is not using these features.Actually, the OOP concept is not based on uses of data structures like CLASS. It is based on the fundamentals of features like Objects, Abstraction, Encapsulation, Polymorphism, Inheritance etc.
If these fundamental features are included in programming then it can be considered in OOP.There is no keyword ‘class’ in Drupal code. Drupal is as non-OOP as many programmers do. But that is not true. Drupal doesn’t contain any class like data structure; still it is still Object Oriented.Drupal covers all these features without classes. Power of Drupal is hardly depends on this programming structure only. The way, how the hook system has been implemented in Drupal would never been possible with the use of Classes.See more details about how Drupal implements Object Oriented Programming (OOP) without using Classes, visit:http://api.drupal.org

Saturday, November 1, 2008

Useful & Quick CSS Injector Module - Drupal 6

This CSS Injector module allows administrators to inject CSS into the page output based on configurable rules.It's useful for adding simple CSS tweaks without modifying a site's official theme -- for example, a 'nighttime' color scheme could be added during certain hours. The CSS is added using Drupal's standard drupal_add_css() function and respects page caching.For downloading this module please visit CSS Injector