<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[Codingmentor Developer's Forum - All Forums]]></title>
		<link>http://www.codingmentor.com/forum/</link>
		<description><![CDATA[Codingmentor Developer's Forum - http://www.codingmentor.com/forum]]></description>
		<pubDate>Sat, 11 Oct 2008 09:44:11 -0400</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[Install PhpSysinfo]]></title>
			<link>http://www.codingmentor.com/forum/showthread.php?tid=200</link>
			<pubDate>Wed, 08 Oct 2008 14:34:25 -0400</pubDate>
			<guid isPermaLink="false">http://www.codingmentor.com/forum/showthread.php?tid=200</guid>
			<description><![CDATA[phpSysInfo is a PHP script that displays information about the host being accessed.It will displays things like Uptime, CPU, Memory, SCSI, IDE, PCI, Ethernet, Floppy, and Video Information.<br />
<br />
Following are the installations step for phpsysinfo.<br />
<br />
cd  /usr/local/apache/htdocs/ ( Or the default path the apache)<br />
<br />
wget http://downloads.sourceforge.net/phpsysinfo/phpSysInfo-<br />
3.0-RC6.tar.gz?modtime=1212699886&big_mirror=0<br />
<br />
tar -xzvf phpSysInfo-3.0-RC6.tar.gz<br />
<br />
cd phpsysinfo<br />
<br />
ls<br />
<br />
If config.php.new is only there then do..<br />
<br />
cp -ar config.php.new config.php<br />
<br />
Then access the phpsysinfo using <br />
<br />
http://IP/phpsysinfo]]></description>
			<content:encoded><![CDATA[phpSysInfo is a PHP script that displays information about the host being accessed.It will displays things like Uptime, CPU, Memory, SCSI, IDE, PCI, Ethernet, Floppy, and Video Information.<br />
<br />
Following are the installations step for phpsysinfo.<br />
<br />
cd  /usr/local/apache/htdocs/ ( Or the default path the apache)<br />
<br />
wget http://downloads.sourceforge.net/phpsysinfo/phpSysInfo-<br />
3.0-RC6.tar.gz?modtime=1212699886&big_mirror=0<br />
<br />
tar -xzvf phpSysInfo-3.0-RC6.tar.gz<br />
<br />
cd phpsysinfo<br />
<br />
ls<br />
<br />
If config.php.new is only there then do..<br />
<br />
cp -ar config.php.new config.php<br />
<br />
Then access the phpsysinfo using <br />
<br />
http://IP/phpsysinfo]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Newbie in Java]]></title>
			<link>http://www.codingmentor.com/forum/showthread.php?tid=199</link>
			<pubDate>Wed, 16 Jul 2008 10:15:03 -0400</pubDate>
			<guid isPermaLink="false">http://www.codingmentor.com/forum/showthread.php?tid=199</guid>
			<description><![CDATA[Gentlemen,<br />
<br />
I need someone to help me in identifying whats wrong with my code? Whenever I try to compile it gives me errors?<br />
<br />
I am new to programming and am still studying. Please help!<br />
<br />
class ArithmeticOperations<br />
{<br />
	int num1 = 12;//Declaring and initiallizing variables<br />
	int num2 = 5;<br />
	int a; int b; int c; int d;<br />
<br />
	public ArithmeticOperations()<br />
	{<br />
		 a    = num1 + num2;<br />
		 b    = num1 - num2;<br />
		 c    = num1 * num2;<br />
		 d    = num1 / num2;<br />
<br />
	}<br />
	<br />
	public Void showData()<br />
		{<br />
			System.out.println("The sum of num1 and num2, is=");<br />
			return a;<br />
			System.out.println("The difference between num1 and num2, is=");<br />
			return b;<br />
			System.out.println("The product of num1 and num2, is=");<br />
			return c;<br />
			System.out.println("The result of dividing num1 by num2, is=");<br />
			return d;<br />
		}<br />
<br />
	public static void main(String args[])<br />
	{<br />
		ArithmeticOperations ao = new ArithmeticOperations();<br />
		ao.showData();<br />
	}			<br />
	<br />
}]]></description>
			<content:encoded><![CDATA[Gentlemen,<br />
<br />
I need someone to help me in identifying whats wrong with my code? Whenever I try to compile it gives me errors?<br />
<br />
I am new to programming and am still studying. Please help!<br />
<br />
class ArithmeticOperations<br />
{<br />
	int num1 = 12;//Declaring and initiallizing variables<br />
	int num2 = 5;<br />
	int a; int b; int c; int d;<br />
<br />
	public ArithmeticOperations()<br />
	{<br />
		 a    = num1 + num2;<br />
		 b    = num1 - num2;<br />
		 c    = num1 * num2;<br />
		 d    = num1 / num2;<br />
<br />
	}<br />
	<br />
	public Void showData()<br />
		{<br />
			System.out.println("The sum of num1 and num2, is=");<br />
			return a;<br />
			System.out.println("The difference between num1 and num2, is=");<br />
			return b;<br />
			System.out.println("The product of num1 and num2, is=");<br />
			return c;<br />
			System.out.println("The result of dividing num1 by num2, is=");<br />
			return d;<br />
		}<br />
<br />
	public static void main(String args[])<br />
	{<br />
		ArithmeticOperations ao = new ArithmeticOperations();<br />
		ao.showData();<br />
	}			<br />
	<br />
}]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Urgent Opening for Perl Instructor]]></title>
			<link>http://www.codingmentor.com/forum/showthread.php?tid=198</link>
			<pubDate>Fri, 14 Mar 2008 07:02:51 -0400</pubDate>
			<guid isPermaLink="false">http://www.codingmentor.com/forum/showthread.php?tid=198</guid>
			<description><![CDATA[Hi Guys n Gals,<br />
<br />
I represent Assure Consulting pvt. ltd. We are IT recruitment and executive search Company based in bangalore and California.<br />
Our Client is looking for one Perl instructor urgently.<br />
the candidate who is interested contact me immediately<br />
with your updated resume at ashmita.bose@gmail.com.<br />
<br />
or you can call at 080-64515450 for further information.<br />
<br />
Please find the attachment for the Job description.<br />
<br />
Thanks & Regards,<br />
Ashmita]]></description>
			<content:encoded><![CDATA[Hi Guys n Gals,<br />
<br />
I represent Assure Consulting pvt. ltd. We are IT recruitment and executive search Company based in bangalore and California.<br />
Our Client is looking for one Perl instructor urgently.<br />
the candidate who is interested contact me immediately<br />
with your updated resume at ashmita.bose@gmail.com.<br />
<br />
or you can call at 080-64515450 for further information.<br />
<br />
Please find the attachment for the Job description.<br />
<br />
Thanks & Regards,<br />
Ashmita]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Reset MySQL root password :]]></title>
			<link>http://www.codingmentor.com/forum/showthread.php?tid=197</link>
			<pubDate>Thu, 14 Feb 2008 07:31:51 -0500</pubDate>
			<guid isPermaLink="false">http://www.codingmentor.com/forum/showthread.php?tid=197</guid>
			<description><![CDATA[Reset MySQL root password :<br />
<br />
Do so: <br />
<br />
	service mysql stop<br />
<br />
wait until MySQL shuts down. Then run <br />
<br />
	mysqld_safe --skip-grant-tables &<br />
<br />
then you will be able to login as root with no password. <br />
<br />
	mysql -uroot mysql <br />
<br />
In MySQL command line prompt issue the following command: <br />
<br />
	UPDATE user SET password=PASSWORD("abcd") WHERE user="root"; <br />
	FLUSH PRIVILEGES;<br />
<br />
At this time your root password is reset to "abcd" and MySQL will now <br />
know the privileges and you'll be able to login with your new password:<br />
<br />
	mysql -uroot -pabcd mysql <br />
<br />
==============================================================]]></description>
			<content:encoded><![CDATA[Reset MySQL root password :<br />
<br />
Do so: <br />
<br />
	service mysql stop<br />
<br />
wait until MySQL shuts down. Then run <br />
<br />
	mysqld_safe --skip-grant-tables &<br />
<br />
then you will be able to login as root with no password. <br />
<br />
	mysql -uroot mysql <br />
<br />
In MySQL command line prompt issue the following command: <br />
<br />
	UPDATE user SET password=PASSWORD("abcd") WHERE user="root"; <br />
	FLUSH PRIVILEGES;<br />
<br />
At this time your root password is reset to "abcd" and MySQL will now <br />
know the privileges and you'll be able to login with your new password:<br />
<br />
	mysql -uroot -pabcd mysql <br />
<br />
==============================================================]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[APF Installation]]></title>
			<link>http://www.codingmentor.com/forum/showthread.php?tid=196</link>
			<pubDate>Sat, 02 Feb 2008 05:32:10 -0500</pubDate>
			<guid isPermaLink="false">http://www.codingmentor.com/forum/showthread.php?tid=196</guid>
			<description><![CDATA[APF Installation<br />
============<br />
<br />
cd /root/<br />
wget http://www.rfxnetworks.com/downloads/apf...nt.tar.gz; tar -xvzf apf-current.tar.gz; cd apf-*/; ./install.sh<br />
<br />
Configuration Steps<br />
===============<br />
<br />
vi /etc/apf/conf.apf<br />
<br />
For Cpanel Server<br />
=============<br />
<br />
Common ingress (inbound) ports<br />
<br />
# Common ingress (inbound) TCP ports -3000_3500 = passive port range for Pure FTPD<br />
IG_TCP_CPORTS="21,22,25,53,80,110,143,443,2082,2083, 2086,2087, 2095, 2096,3000_3500"<br />
<br />
# Common ingress (inbound) UDP ports<br />
IG_UDP_CPORTS="53"<br />
<br />
Common egress (outbound) ports<br />
# Egress filtering [0 = Disabled / 1 = Enabled]<br />
EGF="1"<br />
<br />
# Common egress (outbound) TCP ports<br />
EG_TCP_CPORTS="21,25,80,443,43,2089"<br />
<br />
# Common egress (outbound) UDP ports<br />
EG_UDP_CPORTS="20,21,53" <br />
<br />
Now start the firewall<br />
=================<br />
<br />
/usr/local/sbin/apf -s<br />
<br />
If apf starts properly then we have to change the option for DEV<br />
<br />
vi /etc/apf/conf.apf<br />
<br />
FIND : DEVEL_MODE="1"<br />
CHANGE TO : DEVEL_MODE="0"<br />
<br />
Save and quit.<br />
<br />
Restart APF]]></description>
			<content:encoded><![CDATA[APF Installation<br />
============<br />
<br />
cd /root/<br />
wget http://www.rfxnetworks.com/downloads/apf...nt.tar.gz; tar -xvzf apf-current.tar.gz; cd apf-*/; ./install.sh<br />
<br />
Configuration Steps<br />
===============<br />
<br />
vi /etc/apf/conf.apf<br />
<br />
For Cpanel Server<br />
=============<br />
<br />
Common ingress (inbound) ports<br />
<br />
# Common ingress (inbound) TCP ports -3000_3500 = passive port range for Pure FTPD<br />
IG_TCP_CPORTS="21,22,25,53,80,110,143,443,2082,2083, 2086,2087, 2095, 2096,3000_3500"<br />
<br />
# Common ingress (inbound) UDP ports<br />
IG_UDP_CPORTS="53"<br />
<br />
Common egress (outbound) ports<br />
# Egress filtering [0 = Disabled / 1 = Enabled]<br />
EGF="1"<br />
<br />
# Common egress (outbound) TCP ports<br />
EG_TCP_CPORTS="21,25,80,443,43,2089"<br />
<br />
# Common egress (outbound) UDP ports<br />
EG_UDP_CPORTS="20,21,53" <br />
<br />
Now start the firewall<br />
=================<br />
<br />
/usr/local/sbin/apf -s<br />
<br />
If apf starts properly then we have to change the option for DEV<br />
<br />
vi /etc/apf/conf.apf<br />
<br />
FIND : DEVEL_MODE="1"<br />
CHANGE TO : DEVEL_MODE="0"<br />
<br />
Save and quit.<br />
<br />
Restart APF]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Horde Login problem]]></title>
			<link>http://www.codingmentor.com/forum/showthread.php?tid=195</link>
			<pubDate>Sat, 02 Feb 2008 05:28:48 -0500</pubDate>
			<guid isPermaLink="false">http://www.codingmentor.com/forum/showthread.php?tid=195</guid>
			<description><![CDATA[Horde Login problem<br />
===============<br />
<br />
Try repairing the Horde DB as that can be corrupted.<br />
<br />
mysql> use horde<br />
repair table horde_sessionhandler;]]></description>
			<content:encoded><![CDATA[Horde Login problem<br />
===============<br />
<br />
Try repairing the Horde DB as that can be corrupted.<br />
<br />
mysql> use horde<br />
repair table horde_sessionhandler;]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Adding an SPF record]]></title>
			<link>http://www.codingmentor.com/forum/showthread.php?tid=194</link>
			<pubDate>Sat, 02 Feb 2008 05:23:30 -0500</pubDate>
			<guid isPermaLink="false">http://www.codingmentor.com/forum/showthread.php?tid=194</guid>
			<description><![CDATA[Adding an SPF record<br />
================<br />
<br />
Edit the zone file for the domain for which you wish to add the SPF record.<br />
<br />
Add the following line at the end of the file :<br />
<br />
------------------------------------------------------------------<br />
domain-name.	14400	IN	TXT	"v=spf1 a ptr ~all"<br />
------------------------------------------------------------------<br />
<br />
Save and exit<br />
<br />
Restart named.<br />
<br />
You can check the DNS report for the domain to see if you have done this correctly :))<br />
<br />
NOTE : DO NOT forget the " . " at the end of the domain name !!!]]></description>
			<content:encoded><![CDATA[Adding an SPF record<br />
================<br />
<br />
Edit the zone file for the domain for which you wish to add the SPF record.<br />
<br />
Add the following line at the end of the file :<br />
<br />
------------------------------------------------------------------<br />
domain-name.	14400	IN	TXT	"v=spf1 a ptr ~all"<br />
------------------------------------------------------------------<br />
<br />
Save and exit<br />
<br />
Restart named.<br />
<br />
You can check the DNS report for the domain to see if you have done this correctly :))<br />
<br />
NOTE : DO NOT forget the " . " at the end of the domain name !!!]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[PHP Experts: Why PHP Rocks]]></title>
			<link>http://www.codingmentor.com/forum/showthread.php?tid=192</link>
			<pubDate>Tue, 15 Jan 2008 00:58:18 -0500</pubDate>
			<guid isPermaLink="false">http://www.codingmentor.com/forum/showthread.php?tid=192</guid>
			<description><![CDATA[Hi Friends,<br />
<br />
Read this article its very good.<br />
<br />
http://www.odinjobs.com/blogs/careers/en..._php_rocks]]></description>
			<content:encoded><![CDATA[Hi Friends,<br />
<br />
Read this article its very good.<br />
<br />
http://www.odinjobs.com/blogs/careers/en..._php_rocks]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Javascript syntax equivalent to PHP]]></title>
			<link>http://www.codingmentor.com/forum/showthread.php?tid=191</link>
			<pubDate>Fri, 11 Jan 2008 02:37:04 -0500</pubDate>
			<guid isPermaLink="false">http://www.codingmentor.com/forum/showthread.php?tid=191</guid>
			<description><![CDATA[PHP to Javascript Project: php.js<br />
<br />
This article is part of the 'Porting PHP to Javascript' Project, which aims to decrease the gap between developing for PHP & Javascript.<br />
<br />
Its an very intresting article plz go thru it.<br />
<br />
<br />
http://kevin.vanzonneveld.net/techblog/a...phps_date/]]></description>
			<content:encoded><![CDATA[PHP to Javascript Project: php.js<br />
<br />
This article is part of the 'Porting PHP to Javascript' Project, which aims to decrease the gap between developing for PHP & Javascript.<br />
<br />
Its an very intresting article plz go thru it.<br />
<br />
<br />
http://kevin.vanzonneveld.net/techblog/a...phps_date/]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Top best 84 MySql Performance tips!]]></title>
			<link>http://www.codingmentor.com/forum/showthread.php?tid=189</link>
			<pubDate>Tue, 11 Dec 2007 04:02:11 -0500</pubDate>
			<guid isPermaLink="false">http://www.codingmentor.com/forum/showthread.php?tid=189</guid>
			<description><![CDATA[Following are tips which a developer should keep in mind before designing database.<br />
<br />
# Paging/chunked data retrieval to limit<br />
# Don’t use SELECT *<br />
# Be wary of lots of small quick queries if a longer query can be more efficient<br />
# Use EXPLAIN to profile the query execution plan<br />
# Use Slow Query Log (always have it on!)<br />
# Don’t use DISTINCT when you have or could use GROUP BY<br />
# Use proper data partitions<br />
1. For Cluster. Start thinking about Cluster *before* you need them<br />
<br />
# Insert performance<br />
1. Batch INSERT and REPLACE<br />
2. Use LOAD DATA instead of INSERT<br />
<br />
# LIMIT m,n may not be as fast as it sounds<br />
# Don’t use ORDER BY RAND() if you have > ~2K records<br />
# Use SQL_NO_CACHE when you are SELECTing frequently updated data or large sets of data<br />
# avoid wildcards at the start of LIKE queries<br />
# avoid correlated subqueries and in select and where clause (try to avoid in)<br />
# config params –<br />
# no calculated comparisons — isolate indexed columns<br />
# innodb_flush_commit=0 can help slave lag<br />
# ORDER BY and LIMIT work best with equalities and covered indexes<br />
# isolate workloads don’t let administrative work interfere with customer performance. (ie backups)<br />
# use optimistic locking, not pessimistic locking. try to use shared lock, not exclusive lock. share mode vs. FOR UPDATE<br />
# use row-level instead of table-level locking for OLTP workloads<br />
# Know your storage engines and what performs best for your needs, know that different ones exist.<br />
1. use MERGE tables ARCHIVE tables for logs<br />
<br />
# Optimize for data types, use consistent data types. Use PROCEDURE ANALYSE() to help determine if you need less<br />
# separate text/blobs from metadata, don’t put text/blobs in results if you don’t need them<br />
# if you can, compress text/blobs<br />
# compress static data<br />
# don’t back up static data as often<br />
# derived tables (subqueries in the FROM clause) can be useful for retrieving BLOBs w/out sorting them. (self-join can speed up a query if 1st part finds the IDs and use it to fetch the rest)<br />
# enable and increase the query and buffer caches if appropriate<br />
# ALTER TABLE…ORDER BY can take chronological data and re-order it by a different field<br />
# InnoDB ALWAYS keeps the primary key as part of each index, so do not make the primary key very large, be careful of redundant columns in an index, and this can make the query faster<br />
# Do not duplicate indexes<br />
# Utilize different storage engines on master/slave ie, if you need fulltext indexing on a table.<br />
# BLACKHOLE engine and replication is much faster than FEDERATED tables for things like logs.<br />
# Design sane query schemas. don’t be afraid of table joins, often they are faster than denormalization<br />
# Don’t use boolean flags<br />
# Use a clever key and ORDER BY instead of MAX<br />
# Keep the database host as clean as possible. Do you really need a windowing system on that server?<br />
# Utilize the strengths of the OS<br />
# Hire a MySQL ™ Certified DBA<br />
# Know that there are many consulting companies out there that can help, as well as MySQL’s Professional Services.<br />
# Config variables & tips:<br />
1. use one of the supplied config files<br />
2. key_buffer, unix cache (leave some RAM free), per-connection variables, innodb memory variables<br />
3. be aware of global vs. per-connection variables<br />
4. check SHOW STATUS and SHOW VARIABLES (GLOBAL|SESSION in 5.0 and up)<br />
5. be aware of swapping esp. with Linux, “swappiness” (bypass OS filecache for innodb data files, innodb_flush_method=O_DIRECT if possible (this is also OS specific))<br />
6. defragment tables, rebuild indexes, do table maintenance<br />
7. If you use innodb_flush_txn_commit=1, use a battery-backed hardware cache write controller<br />
8. more RAM is good so faster disk speed<br />
9. use 64-bit architectures<br />
<br />
# Know when to split a complex query and join smaller ones<br />
# Debugging sucks, testing rocks!<br />
# Delete small amounts at a time if you can<br />
# Archive old data — don’t be a pack-rat! 2 common engines for this are ARCHIVE tables and MERGE tables<br />
# use INET_ATON and INET_NTOA for IP addresses, not char or varchar<br />
# make it a habit to REVERSE() email addresses, so you can easily search domains<br />
# –skip-name-resolve<br />
# increase myisam_sort_buffer_size to optimize large inserts (this is a per-connection variable)<br />
# look up memory tuning parameter for on-insert caching<br />
# increase temp table size in a data warehousing environment (default is 32Mb) so it doesn’t write to disk (also constrained by max_heap_table_size, default 16Mb)<br />
# Normalize first, and denormalize where appropriate.<br />
# Databases are not spreadsheets, even though Access really really looks like one. Then again, Access isn’t a real database<br />
# In 5.1 BOOL/BIT NOT NULL type is 1 bit, in previous versions it’s 1 byte.<br />
# A NULL data type can take more room to store than NOT NULL<br />
# Choose appropriate character sets & collations — UTF16 will store each character in 2 bytes, whether it needs it or not, latin1 is faster than UTF8.<br />
# make similar queries consistent so cache is used<br />
# Have good SQL query standards<br />
# Don’t use deprecated features<br />
# Use Triggers wisely<br />
# Run in SQL_MODE=STRICT to help identify warnings<br />
# Turning OR on multiple index fields (]]></description>
			<content:encoded><![CDATA[Following are tips which a developer should keep in mind before designing database.<br />
<br />
# Paging/chunked data retrieval to limit<br />
# Don’t use SELECT *<br />
# Be wary of lots of small quick queries if a longer query can be more efficient<br />
# Use EXPLAIN to profile the query execution plan<br />
# Use Slow Query Log (always have it on!)<br />
# Don’t use DISTINCT when you have or could use GROUP BY<br />
# Use proper data partitions<br />
1. For Cluster. Start thinking about Cluster *before* you need them<br />
<br />
# Insert performance<br />
1. Batch INSERT and REPLACE<br />
2. Use LOAD DATA instead of INSERT<br />
<br />
# LIMIT m,n may not be as fast as it sounds<br />
# Don’t use ORDER BY RAND() if you have > ~2K records<br />
# Use SQL_NO_CACHE when you are SELECTing frequently updated data or large sets of data<br />
# avoid wildcards at the start of LIKE queries<br />
# avoid correlated subqueries and in select and where clause (try to avoid in)<br />
# config params –<br />
# no calculated comparisons — isolate indexed columns<br />
# innodb_flush_commit=0 can help slave lag<br />
# ORDER BY and LIMIT work best with equalities and covered indexes<br />
# isolate workloads don’t let administrative work interfere with customer performance. (ie backups)<br />
# use optimistic locking, not pessimistic locking. try to use shared lock, not exclusive lock. share mode vs. FOR UPDATE<br />
# use row-level instead of table-level locking for OLTP workloads<br />
# Know your storage engines and what performs best for your needs, know that different ones exist.<br />
1. use MERGE tables ARCHIVE tables for logs<br />
<br />
# Optimize for data types, use consistent data types. Use PROCEDURE ANALYSE() to help determine if you need less<br />
# separate text/blobs from metadata, don’t put text/blobs in results if you don’t need them<br />
# if you can, compress text/blobs<br />
# compress static data<br />
# don’t back up static data as often<br />
# derived tables (subqueries in the FROM clause) can be useful for retrieving BLOBs w/out sorting them. (self-join can speed up a query if 1st part finds the IDs and use it to fetch the rest)<br />
# enable and increase the query and buffer caches if appropriate<br />
# ALTER TABLE…ORDER BY can take chronological data and re-order it by a different field<br />
# InnoDB ALWAYS keeps the primary key as part of each index, so do not make the primary key very large, be careful of redundant columns in an index, and this can make the query faster<br />
# Do not duplicate indexes<br />
# Utilize different storage engines on master/slave ie, if you need fulltext indexing on a table.<br />
# BLACKHOLE engine and replication is much faster than FEDERATED tables for things like logs.<br />
# Design sane query schemas. don’t be afraid of table joins, often they are faster than denormalization<br />
# Don’t use boolean flags<br />
# Use a clever key and ORDER BY instead of MAX<br />
# Keep the database host as clean as possible. Do you really need a windowing system on that server?<br />
# Utilize the strengths of the OS<br />
# Hire a MySQL ™ Certified DBA<br />
# Know that there are many consulting companies out there that can help, as well as MySQL’s Professional Services.<br />
# Config variables & tips:<br />
1. use one of the supplied config files<br />
2. key_buffer, unix cache (leave some RAM free), per-connection variables, innodb memory variables<br />
3. be aware of global vs. per-connection variables<br />
4. check SHOW STATUS and SHOW VARIABLES (GLOBAL|SESSION in 5.0 and up)<br />
5. be aware of swapping esp. with Linux, “swappiness” (bypass OS filecache for innodb data files, innodb_flush_method=O_DIRECT if possible (this is also OS specific))<br />
6. defragment tables, rebuild indexes, do table maintenance<br />
7. If you use innodb_flush_txn_commit=1, use a battery-backed hardware cache write controller<br />
8. more RAM is good so faster disk speed<br />
9. use 64-bit architectures<br />
<br />
# Know when to split a complex query and join smaller ones<br />
# Debugging sucks, testing rocks!<br />
# Delete small amounts at a time if you can<br />
# Archive old data — don’t be a pack-rat! 2 common engines for this are ARCHIVE tables and MERGE tables<br />
# use INET_ATON and INET_NTOA for IP addresses, not char or varchar<br />
# make it a habit to REVERSE() email addresses, so you can easily search domains<br />
# –skip-name-resolve<br />
# increase myisam_sort_buffer_size to optimize large inserts (this is a per-connection variable)<br />
# look up memory tuning parameter for on-insert caching<br />
# increase temp table size in a data warehousing environment (default is 32Mb) so it doesn’t write to disk (also constrained by max_heap_table_size, default 16Mb)<br />
# Normalize first, and denormalize where appropriate.<br />
# Databases are not spreadsheets, even though Access really really looks like one. Then again, Access isn’t a real database<br />
# In 5.1 BOOL/BIT NOT NULL type is 1 bit, in previous versions it’s 1 byte.<br />
# A NULL data type can take more room to store than NOT NULL<br />
# Choose appropriate character sets & collations — UTF16 will store each character in 2 bytes, whether it needs it or not, latin1 is faster than UTF8.<br />
# make similar queries consistent so cache is used<br />
# Have good SQL query standards<br />
# Don’t use deprecated features<br />
# Use Triggers wisely<br />
# Run in SQL_MODE=STRICT to help identify warnings<br />
# Turning OR on multiple index fields (]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[MySQL 5.0 backup from java]]></title>
			<link>http://www.codingmentor.com/forum/showthread.php?tid=188</link>
			<pubDate>Tue, 06 Nov 2007 05:35:44 -0500</pubDate>
			<guid isPermaLink="false">http://www.codingmentor.com/forum/showthread.php?tid=188</guid>
			<description><![CDATA[I'm using mySQL 5.0 and tomcat 5 in my web application.<br />
The database is in server.<br />
I want a simple backup utility in my application to backup the database and store in my specified folder location.<br />
<br />
Can any one help me. I have seen lots of site to back database from java. But none of them is working.<br />
<br />
Please help me with correct code.<br />
<br />
Thanks Much.]]></description>
			<content:encoded><![CDATA[I'm using mySQL 5.0 and tomcat 5 in my web application.<br />
The database is in server.<br />
I want a simple backup utility in my application to backup the database and store in my specified folder location.<br />
<br />
Can any one help me. I have seen lots of site to back database from java. But none of them is working.<br />
<br />
Please help me with correct code.<br />
<br />
Thanks Much.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[PHP form, Image upload. Store in MySQL database. Retrieve]]></title>
			<link>http://www.codingmentor.com/forum/showthread.php?tid=187</link>
			<pubDate>Mon, 05 Nov 2007 04:50:50 -0500</pubDate>
			<guid isPermaLink="false">http://www.codingmentor.com/forum/showthread.php?tid=187</guid>
			<description><![CDATA[Check article given in below link. Its a great article for uploading image and store it in mysql database using PHP.<br />
<br />
http://www.wellho.net/solutions/php-exam...reive.html]]></description>
			<content:encoded><![CDATA[Check article given in below link. Its a great article for uploading image and store it in mysql database using PHP.<br />
<br />
http://www.wellho.net/solutions/php-exam...reive.html]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[43 Tips for optimizing your php Code]]></title>
			<link>http://www.codingmentor.com/forum/showthread.php?tid=186</link>
			<pubDate>Tue, 30 Oct 2007 02:47:29 -0400</pubDate>
			<guid isPermaLink="false">http://www.codingmentor.com/forum/showthread.php?tid=186</guid>
			<description><![CDATA[1. If a method can be static, declare it static. Speed improvement is by a factor of 4.<br />
<br />
2. echo is faster than print.<br />
<br />
3. Use echo's multiple parameters instead of string concatenation.<br />
<br />
4. Set the maxvalue for your for-loops before and not in the loop.<br />
<br />
5. Unset your variables to free memory, especially large arrays.<br />
<br />
6. Avoid magic like __get, __set, __autoload<br />
<br />
7. require_once() is expensive<br />
<br />
8. Use full paths in includes and requires, less time spent on resolving the OS paths.<br />
<br />
9. If you need to find out the time when the script started executing, &#36;_SERVER[’REQUEST_TIME’] is preferred to time()<br />
<br />
10. See if you can use strncasecmp, strpbrk and stripos instead of regex<br />
<br />
11. str_replace is faster than preg_replace, but strtr is faster than str_replace by a factor of 4<br />
<br />
12. If the function, such as string replacement function, accepts both arrays and single characters as arguments, and if your argument list is not too long, consider writing a few redundant replacement statements, passing one character at a time, instead of one line of code that accepts arrays as search and replace arguments.<br />
<br />
13. It's better to use select statements than multi if, else if, statements.<br />
<br />
14. Error suppression with @ is very slow.<br />
<br />
15. Turn on apache's mod_deflate<br />
<br />
16. Close your database connections when you're done with them<br />
<br />
18. &#36;row[’id’] is 7 times faster than &#36;row[id]<br />
<br />
19. Error messages are expensive<br />
<br />
20. Do not use functions inside of for loop, such as for (&#36;x=0; &#36;x < count(&#36;array); &#36;x) The count() function gets called each time.<br />
<br />
21. Incrementing a local variable in a method is the fastest. Nearly the same as calling a local variable in a function.<br />
<br />
22. Incrementing a global variable is 2 times slow than a local var.<br />
<br />
23. Incrementing an object property (eg. &#36;this->prop++) is 3 times slower than a local variable.<br />
<br />
24. Incrementing an undefined local variable is 9-10 times slower than a pre-initialized one.<br />
<br />
25. 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.<br />
<br />
26. Method invocation appears to be independent of the number of methods defined in the class because I added 10 more methods to the test class (before and after the test method) with no change in performance.<br />
<br />
27. Methods in derived classes run faster than ones defined in the base class.<br />
<br />
28. A function call with one parameter and an empty function body takes about the same time as doing 7-8 &#36;localvar++ operations. A similar method call is of course about 15 &#36;localvar++ operations.<br />
<br />
29. Surrounding your string by ' instead of " will make things interpret a  little faster since php looks for variables inside "..." but not inside  '...'. Of course you can only do this when you don't need to have  variables in the string.<br />
<br />
30. When echoing strings it's faster to separate them by comma instead of dot. Note: This only works with echo, which is a function that can take several strings as arguments.<br />
<br />
31. A PHP script will be served at least 2-10 times slower than a static  HTML page by Apache. Try to use more static HTML pages and fewer  scripts.<br />
<br />
32. Your PHP scripts are recompiled every time unless the scripts are cached. Install a PHP caching product to typically increase performance by 25-100% by removing compile times.<br />
<br />
33. 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<br />
<br />
34. When working with strings and you need to check that the string is  either of a certain length you'd understandably would want to use the  strlen() function. This function is pretty quick since it's operation  does not perform any calculation but merely return the already known  length of a string available in the zval structure (internal C struct  used to store variables in PHP). However because strlen() is a function  it is still somewhat slow because the function call requires several  operations such as lowercase & hashtable lookup followed by the  execution of said function. In some instance you can improve the speed  of your code by using an isset() trick.<br />
Ex.<br />
if (strlen(&#36;foo) < 5) { echo "Foo is too short"; }<br />
vs.<br />
if (!isset(&#36;foo{5})) { echo "Foo is too short"; }<br />
<br />
Calling isset() happens to be faster then strlen() because unlike  strlen(), isset() is a language construct and not a function meaning  that it's execution does not require function lookups and lowercase.  This means you have virtually no overhead on top of the actual code  that determines the string's length.<br />
<br />
35. When incrementing or decrementing the value of the variable &#36;i++  happens to be a tad slower then ++&#36;i. This is something PHP specific  and does not apply to other languages, so don't go modifying your C or  Java code thinking it'll suddenly become faster, it won't. ++&#36;i happens  to be faster in PHP because instead of 4 opcodes used for &#36;i++ you only  need 3. Post incrementation actually causes in the creation of a  temporary var that is then incremented. While pre-incrementation  increases the original value directly. This is one of the optimization  that opcode optimized like Zend's PHP optimizer. It is a still a good  idea to keep in mind since not all opcode optimizers perform this  optimization and there are plenty of ISPs and servers running without  an opcode optimizer.<br />
<br />
36. Not everything has to be OOP, often it is too much overhead, each method and object call consumes a lot of memory. <br />
<br />
37. Do not implement every data structure as a class, arrays are useful, too<br />
<br />
38. Don't split methods too much, think, which code you will really re-use<br />
<br />
39. You can always split the code of a method later, when needed<br />
<br />
40. Make use of the countless predefined functions<br />
<br />
41. If you have very time consuming functions in your code, consider writing them as C extensions<br />
<br />
42. Profile your code. A profiler shows you, which parts of your code consumes how many time. The Xdebug debugger already contains a profiler. Profiling shows you the bottlenecks in overview<br />
<br />
43. 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%<br />
<br />
Nice Article about optimizing php by John Lim click here for more info.]]></description>
			<content:encoded><![CDATA[1. If a method can be static, declare it static. Speed improvement is by a factor of 4.<br />
<br />
2. echo is faster than print.<br />
<br />
3. Use echo's multiple parameters instead of string concatenation.<br />
<br />
4. Set the maxvalue for your for-loops before and not in the loop.<br />
<br />
5. Unset your variables to free memory, especially large arrays.<br />
<br />
6. Avoid magic like __get, __set, __autoload<br />
<br />
7. require_once() is expensive<br />
<br />
8. Use full paths in includes and requires, less time spent on resolving the OS paths.<br />
<br />
9. If you need to find out the time when the script started executing, &#36;_SERVER[’REQUEST_TIME’] is preferred to time()<br />
<br />
10. See if you can use strncasecmp, strpbrk and stripos instead of regex<br />
<br />
11. str_replace is faster than preg_replace, but strtr is faster than str_replace by a factor of 4<br />
<br />
12. If the function, such as string replacement function, accepts both arrays and single characters as arguments, and if your argument list is not too long, consider writing a few redundant replacement statements, passing one character at a time, instead of one line of code that accepts arrays as search and replace arguments.<br />
<br />
13. It's better to use select statements than multi if, else if, statements.<br />
<br />
14. Error suppression with @ is very slow.<br />
<br />
15. Turn on apache's mod_deflate<br />
<br />
16. Close your database connections when you're done with them<br />
<br />
18. &#36;row[’id’] is 7 times faster than &#36;row[id]<br />
<br />
19. Error messages are expensive<br />
<br />
20. Do not use functions inside of for loop, such as for (&#36;x=0; &#36;x < count(&#36;array); &#36;x) The count() function gets called each time.<br />
<br />
21. Incrementing a local variable in a method is the fastest. Nearly the same as calling a local variable in a function.<br />
<br />
22. Incrementing a global variable is 2 times slow than a local var.<br />
<br />
23. Incrementing an object property (eg. &#36;this->prop++) is 3 times slower than a local variable.<br />
<br />
24. Incrementing an undefined local variable is 9-10 times slower than a pre-initialized one.<br />
<br />
25. 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.<br />
<br />
26. Method invocation appears to be independent of the number of methods defined in the class because I added 10 more methods to the test class (before and after the test method) with no change in performance.<br />
<br />
27. Methods in derived classes run faster than ones defined in the base class.<br />
<br />
28. A function call with one parameter and an empty function body takes about the same time as doing 7-8 &#36;localvar++ operations. A similar method call is of course about 15 &#36;localvar++ operations.<br />
<br />
29. Surrounding your string by ' instead of " will make things interpret a  little faster since php looks for variables inside "..." but not inside  '...'. Of course you can only do this when you don't need to have  variables in the string.<br />
<br />
30. When echoing strings it's faster to separate them by comma instead of dot. Note: This only works with echo, which is a function that can take several strings as arguments.<br />
<br />
31. A PHP script will be served at least 2-10 times slower than a static  HTML page by Apache. Try to use more static HTML pages and fewer  scripts.<br />
<br />
32. Your PHP scripts are recompiled every time unless the scripts are cached. Install a PHP caching product to typically increase performance by 25-100% by removing compile times.<br />
<br />
33. 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<br />
<br />
34. When working with strings and you need to check that the string is  either of a certain length you'd understandably would want to use the  strlen() function. This function is pretty quick since it's operation  does not perform any calculation but merely return the already known  length of a string available in the zval structure (internal C struct  used to store variables in PHP). However because strlen() is a function  it is still somewhat slow because the function call requires several  operations such as lowercase & hashtable lookup followed by the  execution of said function. In some instance you can improve the speed  of your code by using an isset() trick.<br />
Ex.<br />
if (strlen(&#36;foo) < 5) { echo "Foo is too short"; }<br />
vs.<br />
if (!isset(&#36;foo{5})) { echo "Foo is too short"; }<br />
<br />
Calling isset() happens to be faster then strlen() because unlike  strlen(), isset() is a language construct and not a function meaning  that it's execution does not require function lookups and lowercase.  This means you have virtually no overhead on top of the actual code  that determines the string's length.<br />
<br />
35. When incrementing or decrementing the value of the variable &#36;i++  happens to be a tad slower then ++&#36;i. This is something PHP specific  and does not apply to other languages, so don't go modifying your C or  Java code thinking it'll suddenly become faster, it won't. ++&#36;i happens  to be faster in PHP because instead of 4 opcodes used for &#36;i++ you only  need 3. Post incrementation actually causes in the creation of a  temporary var that is then incremented. While pre-incrementation  increases the original value directly. This is one of the optimization  that opcode optimized like Zend's PHP optimizer. It is a still a good  idea to keep in mind since not all opcode optimizers perform this  optimization and there are plenty of ISPs and servers running without  an opcode optimizer.<br />
<br />
36. Not everything has to be OOP, often it is too much overhead, each method and object call consumes a lot of memory. <br />
<br />
37. Do not implement every data structure as a class, arrays are useful, too<br />
<br />
38. Don't split methods too much, think, which code you will really re-use<br />
<br />
39. You can always split the code of a method later, when needed<br />
<br />
40. Make use of the countless predefined functions<br />
<br />
41. If you have very time consuming functions in your code, consider writing them as C extensions<br />
<br />
42. Profile your code. A profiler shows you, which parts of your code consumes how many time. The Xdebug debugger already contains a profiler. Profiling shows you the bottlenecks in overview<br />
<br />
43. 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%<br />
<br />
Nice Article about optimizing php by John Lim click here for more info.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Calling VB Functions/Dlls in ABAP Programming]]></title>
			<link>http://www.codingmentor.com/forum/showthread.php?tid=185</link>
			<pubDate>Thu, 18 Oct 2007 07:24:22 -0400</pubDate>
			<guid isPermaLink="false">http://www.codingmentor.com/forum/showthread.php?tid=185</guid>
			<description><![CDATA[Hai all,<br />
Can anyone let me know how to <br />
Call VB Functions/Dlls in ABAP Programming<br />
<br />
Any ideas regarding this <br />
Thanks in advance<br />
Amar]]></description>
			<content:encoded><![CDATA[Hai all,<br />
Can anyone let me know how to <br />
Call VB Functions/Dlls in ABAP Programming<br />
<br />
Any ideas regarding this <br />
Thanks in advance<br />
Amar]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Ban an IP Address From The Server]]></title>
			<link>http://www.codingmentor.com/forum/showthread.php?tid=184</link>
			<pubDate>Fri, 28 Sep 2007 09:58:57 -0400</pubDate>
			<guid isPermaLink="false">http://www.codingmentor.com/forum/showthread.php?tid=184</guid>
			<description><![CDATA[Have a user that keeps hammering your FTP or trying to login over and over and over again that you just want to ban and never see again? We'll show a quick and dirty method to ban an IP address from the server.<br />
<br />
We commonly receive questions like:<br />
"I would like to ban that ip address to prevent the access to the server.<br />
<br />
how can i ban that Ip address from the server?"<br />
<br />
Simple!<br />
<br />
1) Login to the server as and su  - to root.<br />
<br />
2) If you are running iptables, you can enter:<br />
<br />
iptables -A INPUT -s  -j DROP<br />
<br />
3) If you have APF firewall installed<br />
<br />
apf -d <br />
<br />
4) When you reboot this IP ban will be removed, meaning the IP will no longer be banned anymore.<br />
If you have APF you can get around this by opening the deny hosts file.<br />
<br />
pico /etc/apf/deny_hosts.rules<br />
<br />
Scroll to the bottom and paste in the IP address.<br />
Ctrl+X then Y to save the changes and exit.<br />
<br />
5) Restart APF<br />
/etc/apf/apf -r]]></description>
			<content:encoded><![CDATA[Have a user that keeps hammering your FTP or trying to login over and over and over again that you just want to ban and never see again? We'll show a quick and dirty method to ban an IP address from the server.<br />
<br />
We commonly receive questions like:<br />
"I would like to ban that ip address to prevent the access to the server.<br />
<br />
how can i ban that Ip address from the server?"<br />
<br />
Simple!<br />
<br />
1) Login to the server as and su  - to root.<br />
<br />
2) If you are running iptables, you can enter:<br />
<br />
iptables -A INPUT -s  -j DROP<br />
<br />
3) If you have APF firewall installed<br />
<br />
apf -d <br />
<br />
4) When you reboot this IP ban will be removed, meaning the IP will no longer be banned anymore.<br />
If you have APF you can get around this by opening the deny hosts file.<br />
<br />
pico /etc/apf/deny_hosts.rules<br />
<br />
Scroll to the bottom and paste in the IP address.<br />
Ctrl+X then Y to save the changes and exit.<br />
<br />
5) Restart APF<br />
/etc/apf/apf -r]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Force (SSL) secure logins in WHM and Cpanel]]></title>
			<link>http://www.codingmentor.com/forum/showthread.php?tid=183</link>
			<pubDate>Fri, 28 Sep 2007 09:53:46 -0400</pubDate>
			<guid isPermaLink="false">http://www.codingmentor.com/forum/showthread.php?tid=183</guid>
			<description><![CDATA[This tutorial will show you how to accomplish https connections when going to servername/whm or /cpanel for those who may still be using the insecure ways to login to WHM and CPanel forcing a secure connection for all users.<br />
<br />
Step 1: Backup files<br />
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.insecure<br />
<br />
Step 2: Edit the file<br />
pico /etc/httpd/conf/httpd.conf<br />
<br />
Step 3: Search for the line:<br />
Ctrl+W   then  ScriptAlias /cpanel /usr/local/cpanel/base/redirect.cgi<br />
<br />
Step 4: Edit the line to show the following: <br />
ScriptAlias /cpanel /usr/local/cpanel/base/sredirect.cgi (simply change the redirect.cgi to sredirect.cgi)<br />
<br />
Step 5: Search for the line:<br />
Ctrl+W   then  ScriptAlias /whm /usr/local/cpanel/base/whmredirect.cgi<br />
<br />
Step 6: Edit the line to show the following:<br />
ScriptAlias /whm /usr/local/cpanel/base/swhmredirect.cgi (simply change the whmredirect.cgi to swhmredirect.cgi)<br />
<br />
Step 7: Save and exit using the following: <br />
Ctrl+X  then press Y<br />
<br />
Step 8: Restart Apache to have changes take effect:<br />
service httpd restart ]]></description>
			<content:encoded><![CDATA[This tutorial will show you how to accomplish https connections when going to servername/whm or /cpanel for those who may still be using the insecure ways to login to WHM and CPanel forcing a secure connection for all users.<br />
<br />
Step 1: Backup files<br />
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.insecure<br />
<br />
Step 2: Edit the file<br />
pico /etc/httpd/conf/httpd.conf<br />
<br />
Step 3: Search for the line:<br />
Ctrl+W   then  ScriptAlias /cpanel /usr/local/cpanel/base/redirect.cgi<br />
<br />
Step 4: Edit the line to show the following: <br />
ScriptAlias /cpanel /usr/local/cpanel/base/sredirect.cgi (simply change the redirect.cgi to sredirect.cgi)<br />
<br />
Step 5: Search for the line:<br />
Ctrl+W   then  ScriptAlias /whm /usr/local/cpanel/base/whmredirect.cgi<br />
<br />
Step 6: Edit the line to show the following:<br />
ScriptAlias /whm /usr/local/cpanel/base/swhmredirect.cgi (simply change the whmredirect.cgi to swhmredirect.cgi)<br />
<br />
Step 7: Save and exit using the following: <br />
Ctrl+X  then press Y<br />
<br />
Step 8: Restart Apache to have changes take effect:<br />
service httpd restart ]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[MySql Backup and restoring backup from Command Line]]></title>
			<link>http://www.codingmentor.com/forum/showthread.php?tid=182</link>
			<pubDate>Fri, 28 Sep 2007 09:16:04 -0400</pubDate>
			<guid isPermaLink="false">http://www.codingmentor.com/forum/showthread.php?tid=182</guid>
			<description><![CDATA[Taking Backup with mysqldump<br />
<br />
<br />
Quote:mysqldump -u root --add-drop-table user_dbname > /path/user_dbname.sql<br />
<br />
<br />
<br />
Restoring Backup<br />
<br />
<br />
Quote:mysql -u user user_dbname < user_dbname.sql<br />
<br />
]]></description>
			<content:encoded><![CDATA[Taking Backup with mysqldump<br />
<br />
<br />
Quote:mysqldump -u root --add-drop-table user_dbname > /path/user_dbname.sql<br />
<br />
<br />
<br />
Restoring Backup<br />
<br />
<br />
Quote:mysql -u user user_dbname < user_dbname.sql<br />
<br />
]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[10 things you (probably) didn’t know about PHP]]></title>
			<link>http://www.codingmentor.com/forum/showthread.php?tid=181</link>
			<pubDate>Fri, 17 Aug 2007 05:11:11 -0400</pubDate>
			<guid isPermaLink="false">http://www.codingmentor.com/forum/showthread.php?tid=181</guid>
			<description><![CDATA[PHP is simultaneously the most infuriating and joyful languages I’ve ever worked with. I say “infuriating” primarily because the function names are so inconsistant. Despite the fact that I use it almost everyday, I still have to think to myself “Is it str_pos or strpos? str_split or strsplit?” On the other hand, occasionally I’ll stumble across a gem that perfectly solves the problem at hand with a single line of code.<br />
<br />
Here’s a short list of cool features that might have slipped under your radar as well:<br />
<br />
1. Use ip2long() and long2ip() to store IP addresses as integers instead of strings in a database. This will reduce the storage space by almost a factor of four (15 bytes for char(15) vs. 4 bytes for the integer), make it easier to calculate whether a certain address falls within a range, and speed-up searches and sorts (sometimes by quite a bit).<br />
<br />
2. Partially validate email addresses by checking that the domain name exists with [i]checkdnsrr()[/i]. This built-in function checks to ensure that a specified domain name resolves to an IP address. A simple user-defined function that builds on checkdnsrr() to partially valid email addresses can be found in the user comments section in the PHP docs. This is handy for catching those occasional folks who think their email address is ‘sandy@wwwyahoo.com’ instead of ‘sandy@yahoo.com’.<br />
<br />
3. If you’re using PHP 5 with MySQL 4.1 or above, consider ditching the mysql_* functions for the improved mysqli_* functions. One nice feature is that you can use prepared statements, which may speed up queries if you maintain a database-intensive website.<br />
<br />
4. Learn to love the ternary operator.<br />
<br />
5. If you get the feeling that you might be reinventing the wheel during a project, check PEAR before you write another line. PEAR is a great resource that many PHP developers are aware of, yet many more are not. It’s an online repository containing over 400 reusable snippets that can be dropped right into your PHP application. Unless your project is trully unique, you ought to be able to find a PEAR package that saves at least a little time. (Also see PECL)<br />
<br />
6.Automatically print a nicely formatted copy of a page’s source code with highlight_file().This function is handy for when you need to ask for some assistance with a script in a messageboard, IRC, etc. Obviously, some care must be taken not to accidently show your source when it contains DB connection information, passwords, etc.<br />
<br />
7. Prevent potentially sensitive error messages from being shown to users with the error_reporting(0) function. Ideally error reporting should be completely disabled on a production server from within php.ini. However if you’re on a shared webhost and you aren’t given your own php.ini, then your best bet is to add error_reporting(0); as the first line in each of your scripts (or use it with require_once().) This will prevent potentially sensitive SQL queries and path names from being displayed if things go awry.<br />
<br />
8. Use gzcompress() and gzuncompress() to transparently compress/decompress large strings before storing them in a database. These built-in functions use the gzip algorithm and can compress plaintext up to 90%. I use these functions almost everytime I read/write to a BLOB field within PHP. The only exception is when I need full text indexing capabilities.<br />
<br />
9. Return multiple values from a function with “by reference” parameters. Like the ternary operator, most PHP developers who come from a more formalized programming background already know this one. However, those who’s background is more HTML than Pascal, probably have wondered at one time “how do I get multiple values back from a function I wrote, even though I can only use one return value?” The answer is that you precede a variable with “&” and use it “by reference” instead of “by value”.<br />
<br />
10. Fully understand “magic quotes” and the dangers of SQL injection. I’m hoping that most developers reading this are already familiar with SQL injection. However, I list it here because it’s absolutely critical to understand. If you’ve never heard the term before, spend the entire rest of the day googling and reading.]]></description>
			<content:encoded><![CDATA[PHP is simultaneously the most infuriating and joyful languages I’ve ever worked with. I say “infuriating” primarily because the function names are so inconsistant. Despite the fact that I use it almost everyday, I still have to think to myself “Is it str_pos or strpos? str_split or strsplit?” On the other hand, occasionally I’ll stumble across a gem that perfectly solves the problem at hand with a single line of code.<br />
<br />
Here’s a short list of cool features that might have slipped under your radar as well:<br />
<br />
1. Use ip2long() and long2ip() to store IP addresses as integers instead of strings in a database. This will reduce the storage space by almost a factor of four (15 bytes for char(15) vs. 4 bytes for the integer), make it easier to calculate whether a certain address falls within a range, and speed-up searches and sorts (sometimes by quite a bit).<br />
<br />
2. Partially validate email addresses by checking that the domain name exists with [i]checkdnsrr()[/i]. This built-in function checks to ensure that a specified domain name resolves to an IP address. A simple user-defined function that builds on checkdnsrr() to partially valid email addresses can be found in the user comments section in the PHP docs. This is handy for catching those occasional folks who think their email address is ‘sandy@wwwyahoo.com’ instead of ‘sandy@yahoo.com’.<br />
<br />
3. If you’re using PHP 5 with MySQL 4.1 or above, consider ditching the mysql_* functions for the improved mysqli_* functions. One nice feature is that you can use prepared statements, which may speed up queries if you maintain a database-intensive website.<br />
<br />
4. Learn to love the ternary operator.<br />
<br />
5. If you get the feeling that you might be reinventing the wheel during a project, check PEAR before you write another line. PEAR is a great resource that many PHP developers are aware of, yet many more are not. It’s an online repository containing over 400 reusable snippets that can be dropped right into your PHP application. Unless your project is trully unique, you ought to be able to find a PEAR package that saves at least a little time. (Also see PECL)<br />
<br />
6.Automatically print a nicely formatted copy of a page’s source code with highlight_file().This function is handy for when you need to ask for some assistance with a script in a messageboard, IRC, etc. Obviously, some care must be taken not to accidently show your source when it contains DB connection information, passwords, etc.<br />
<br />
7. Prevent potentially sensitive error messages from being shown to users with the error_reporting(0) function. Ideally error reporting should be completely disabled on a production server from within php.ini. However if you’re on a shared webhost and you aren’t given your own php.ini, then your best bet is to add error_reporting(0); as the first line in each of your scripts (or use it with require_once().) This will prevent potentially sensitive SQL queries and path names from being displayed if things go awry.<br />
<br />
8. Use gzcompress() and gzuncompress() to transparently compress/decompress large strings before storing them in a database. These built-in functions use the gzip algorithm and can compress plaintext up to 90%. I use these functions almost everytime I read/write to a BLOB field within PHP. The only exception is when I need full text indexing capabilities.<br />
<br />
9. Return multiple values from a function with “by reference” parameters. Like the ternary operator, most PHP developers who come from a more formalized programming background already know this one. However, those who’s background is more HTML than Pascal, probably have wondered at one time “how do I get multiple values back from a function I wrote, even though I can only use one return value?” The answer is that you precede a variable with “&” and use it “by reference” instead of “by value”.<br />
<br />
10. Fully understand “magic quotes” and the dangers of SQL injection. I’m hoping that most developers reading this are already familiar with SQL injection. However, I list it here because it’s absolutely critical to understand. If you’ve never heard the term before, spend the entire rest of the day googling and reading.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Upcoming PHP 6 - Features and advantages]]></title>
			<link>http://www.codingmentor.com/forum/showthread.php?tid=180</link>
			<pubDate>Tue, 07 Aug 2007 05:28:14 -0400</pubDate>
			<guid isPermaLink="false">http://www.codingmentor.com/forum/showthread.php?tid=180</guid>
			<description><![CDATA[Hi,<br />
<br />
Check this blog great info added on PHP 6.<br />
<br />
http://phpmysqldev.blogspot.com/]]></description>
			<content:encoded><![CDATA[Hi,<br />
<br />
Check this blog great info added on PHP 6.<br />
<br />
http://phpmysqldev.blogspot.com/]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Top Ten CSS Tricks]]></title>
			<link>http://www.codingmentor.com/forum/showthread.php?tid=179</link>
			<pubDate>Mon, 06 Aug 2007 06:47:15 -0400</pubDate>
			<guid isPermaLink="false">http://www.codingmentor.com/forum/showthread.php?tid=179</guid>
			<description><![CDATA[CSS can be complex, and as each new browser version is released, you may well find yourself struggling to keep up with the latest tips and hacks.<br />
<br />
1. Block vs. Inline Level Elements<br />
<br />
Nearly all HTML elements are either block or inline elements. The characteristics of block elements include:<br />
<br />
    * Always begin on a new line<br />
    * Height, line-height and top and bottom margins can be manipulated<br />
    * Width defaults to 100% of their containing element, unless a width is specified<br />
<br />
Examples of block elements include , , , ,  and . The characteristics of inline elements, on the other hand, are the opposite of block elements:<br />
<br />
    * Begin on the same line<br />
    * Height, line-height and top and bottom margins can't be changed<br />
    * Width is as long as the text/image and can't be manipulated<br />
<br />
Examples of inline elements include , , , , ,  and .<br />
<br />
To change an element's status, you can use display: inline or display: block. But what's the point of changing an element from being block to inline, or vice-versa? Well, at first it may seem like you might hardly ever use this trick, but in actual fact, this is a very powerful technique, which you can use whenever you want to:<br />
<br />
    * Have an inline element start on a new line<br />
    * Have a block element start on the same line<br />
    * Control the width of an inline element (particularly useful for navigation links)<br />
    * Manipulate the height of an inline element<br />
    * Set a background colour as wide as the text for block elements, without having to specify a width<br />
<br />
2. Another Box Model Hack Alternative<br />
<br />
The box model hack is used to fix a rendering problem in pre-IE 6 browsers on PC, whereby the border and padding are included in, rather than added onto, the width of an element. A number of CSS-based solutions have been put forward to remedy this; here's another one that I really like: <br />
<br />
<br />
Quote:padding: 2em; border: 1em solid green; width: 20em; width/**/:/**/ 14em;<br />
<br />
<br />
The first width command is read by all browsers; the second by all browsers except IE5 [4].x on PC. Because the second command comes second, it takes precedence over the first: any command that comes second will always override a preceding command. So, how does all this work?<br />
<br />
By placing empty comment tags (/**/) before the colons, we instruct IE5.0 to ignore the command. Likewise, if we place empty comment tags after the colon, IE5.5 will ignore the command. Using these two rules in conjunction with each other, we can hide the command from all of IE5.x browsers.<br />
<br />
3. Minimum Width for a Page<br />
<br />
A very handy CSS command that exists is the min-width command, whereby you can specify a minimum width for any element. This can be particularly useful for specifying a minimum width for a page.<br />
<br />
Unfortunately, IE doesn't understand this command, so we'll need to come up with a new way of making this functionality work in this browser. First, we'll insert a  under the  tag, as we can't assign a minimum width to the : <br />
<br />
<br />
Quote:<br />
<br />
<br />
Next, we create our CSS commands, to create a minimum width of 600px:<br />
<br />
Quote:#container<br />
{<br />
min-width: 600px;<br />
width:expression(document.body.clientWidth < 600? "600px":"auto" );<br />
}<br />
<br />
<br />
The first command is the regular minimum width command; the second is a short JavaScript command that only IE understands. Do note, though, that this command will cause your CSS document to become invalid; you may prefer to insert it into the head of each HTML document to get around this.<br />
<br />
You might also want to combine this minimum width with a maximum width: <br />
<br />
Quote:#container<br />
{<br />
min-width: 600px;<br />
max-width: 1200px;<br />
width:expression(document.body.clientWidth < 600? "600px" : document.body.clientWidth > 1200? "1200px" : "auto"); }<br />
<br />
<br />
4. IE and Width and Height Issues<br />
<br />
IE has a rather strange way of doing things. It doesn't understand the min-width and min-height commands, but instead interprets width and height as min-width and min-height -- go figure!<br />
<br />
This can cause problems, because we may need boxes to be resizable should we need to fit more text into them, or should the user resize the text. If we use only the width and height commands on a box, non-IE browsers won't allow the box to resize. If we only use the min-width and min-height commands, though, we can't control the width or height in IE!<br />
<br />
This can be especially problematic when using background images. If you're using a background image that's 80px wide and 35px high, you'll want to make sure that the default size for a box using this image is exactly 80 x 35px. However, if users resize the text, the box size will need to expand gracefully.<br />
<br />
To resolve this problem, you can use the following code for a box with class="box": <br />
<br />
<br />
Quote:.box<br />
{<br />
width: 80px;<br />
height: 35px;<br />
}<br />
<br />
html>body .box<br />
{<br />
width: auto;<br />
height: auto;<br />
min-width: 80px;<br />
min-height: 35px;<br />
}<br />
<br />
<br />
All browsers will read through the first CSS rule, but IE will ignore the second rule because it makes use of the child selector command. Non-IE browsers will read through the second one, which will override the values from the first rule, because this CSS rule is more specific, and CSS rules that are more specific always override those that are less specific.<br />
<br />
5. Text-transform Command<br />
<br />
One of the lesser known, but really useful CSS commands is the text-transform command. Three of the more common values for this rule are: text-transform: uppercase, text-transform: lowercase and text-transform: capitalize. The first rule turns all characters into capital letters, the second turns them all into small letters, and the third makes the first letter of each word a capital letter.<br />
<br />
This command is incredibly useful to help ensure consistency in style across an entire Website, particularly if it has a number of content editors. Say for example your style guide dictates that words in headings must always begin with capital letters. To ensure that this is always the case, use text-transform: capitalize. Even if site editors forget about the capitalisation, their mistake won't show up on the Website. <br />
<br />
It's also preferable to use text-transform: uppercase to capitalise words, as screen readers may pronounce shorter words in capital letters as acronyms. A great example of this is 'CONTACT US', which is pronounced as 'contact US' by some screen readers.<br />
<br />
6. Disappearing Text or Images in IE?<br />
<br />
IE exhibits a very strange bug whereby text or background images sometimes disappear from sight. These items are still actually present and, if you highlight everything on screen or hit refresh, they'll often re-appear. Kind of strange, huh?<br />
<br />
This problem mostly occurs on background images and on text positioned next to a floated element. To remedy the problem, simply insert position: relative into the CSS command for the disappearing element, and for some bizarre reason, that'll usually fix the problem. If this doesn&339;t work (and sometimes, it doesn't), assign a width to the offending element in the CSS -- that should fix the problem.<br />
<br />
7. Invisible Text<br />
<br />
Sometimes, you may actually want to make text invisible. Invisible text can be especially useful for screen reader users, perhaps to assign a label to a form item, or insert a heading ahead of a section. Don't want to change the visual appearance by inserting these elements? Make them invisible, and no one using a visual browser will know they're there.<br />
<br />
You may also want to make text invisible if using a print or handheld CSS file, as some information may not need to be displayed on either of these mediums (see below for more on this).<br />
<br />
To make text invisible, you can use display: none -- easy! This works fine for hiding text from handhelds (if CSS is supported) and printed Web pages, but isn't so great for many screen readers. Screen readers are now becoming too clever for their own good, and some will actually ignore any text that has the rule display: none assigned to it.<br />
<br />
Therefore, for screen readers users, a new approach is needed: position: absolute; left: -9000px. This basically takes the text and positions it 9000px to the left of the left edge of the screen, essentially making it invisible.<br />
<br />
8. CSS Document for Handhelds<br />
<br />
A separate CSS document can be created for PDAs and mobile phones, and activated only when one of these devices is being used to access your site. More and more Websites are creating separate CSS documents for printing, so Web pages automatically become print-friendly when users choose to print them. You can do the same for handheld devices.<br />
<br />
The following command is used to call up the CSS document for handhelds: <br />
<br />
<br />
Quote:<br />
<br />
<br />
CSS commands in the handheld CSS file override any equivalent commands in the main CSS document. So, what commands should you place in this file? Ideally, you want users of handheld devices to avoid having to scroll horizontally.<br />
<br />
To test this, open up your Website in a regular browser window and resize it to 150px in width. Then, open up your main CSS file and insert some new commands at the very bottom of the document. The commands you place here should adjust the layout of the Website so that it doesn't require horizontal scrolling at a width of 150px. Then, open up a new document, cut and paste these new commands over, and save it as handheldstyle.css (or whatever name you want to give it).<br />
<br />
Your Websites offering to users of handheld devices should be quite different to its offering to traditional Web browsers, as the user experience is quite different on a handheld device. For further information, a book such as "Handheld Usability", by S.W. Weiss, is a great read.<br />
<br />
9. 3-d Push Button Effect<br />
<br />
Back in the early days of the Web, 3-d buttons that appeared to become pushed in when moused over were all the rage. At that time, this could only be achieved through images and JavaScript, but now, with the advent of CSS, we can go retro and re-create this 3-d effect.<br />
<br />
The main CSS commands you'll need are: <br />
<br />
Quote:a {<br />
display: block;<br />
border: 1px solid;<br />
border-color: #aaa #000 #000 #aaa;<br />
width: 8em;<br />
background: #fc0;<br />
}<br />
<br />
a:hover<br />
{<br />
position: relative;<br />
top: 1px;<br />
left: 1px;<br />
border-color: #000 #aaa #aaa #000;<br />
}<br />
<br />
<br />
Aside from these commands, you can insert other commands to achieve the desired presentation effect -- the only limit is your imagination!<br />
<br />
10. Same Navigation Code on Every Page<br />
<br />
Most Websites highlight the navigation item relating to each user's location within the Website, to help users orientate themselves. This is a fundamental requirement for basic usability, but it can be a pain: we need to tweak the HTML code behind the navigation for each and every page. Can we have the best of both worlds? Is it possible to have the navigation highlighted on every page, without having to tweak the HTML code on every page? Of course it is!<br />
<br />
First of all, you'll need to assign a class to each navigation item: <br />
<br />
Quote:<br />
Home<br />
About us<br />
Contact us<br />
<br />
<br />
<br />
You'll then need to insert an id into the  tag. The id should be representative of where users are located in the site, and should change when users move to a different site section. When on the 'Home' page, it should read , in 'About Us', it should read , and in 'Contact Us', .<br />
<br />
Next, you create a new CSS rule:<br />
<br />
Quote:#home .home, #about .about, #about .about, #contact .contact<br />
{<br />
commands for highlighted navigation go here<br />
} <br />
<br />
<br />
This basically creates a rule that only takes effect when class="home" is contained within id="home", and when class="about" is in id="about" and class="contact" is in id="contact". These situations will only occur when the user is in the appropriate section of the site, seamlessly creating our highlighted navigation item.]]></description>
			<content:encoded><![CDATA[CSS can be complex, and as each new browser version is released, you may well find yourself struggling to keep up with the latest tips and hacks.<br />
<br />
1. Block vs. Inline Level Elements<br />
<br />
Nearly all HTML elements are either block or inline elements. The characteristics of block elements include:<br />
<br />
    * Always begin on a new line<br />
    * Height, line-height and top and bottom margins can be manipulated<br />
    * Width defaults to 100% of their containing element, unless a width is specified<br />
<br />
Examples of block elements include , , , ,  and . The characteristics of inline elements, on the other hand, are the opposite of block elements:<br />
<br />
    * Begin on the same line<br />
    * Height, line-height and top and bottom margins can't be changed<br />
    * Width is as long as the text/image and can't be manipulated<br />
<br />
Examples of inline elements include , , , , ,  and .<br />
<br />
To change an element's status, you can use display: inline or display: block. But what's the point of changing an element from being block to inline, or vice-versa? Well, at first it may seem like you might hardly ever use this trick, but in actual fact, this is a very powerful technique, which you can use whenever you want to:<br />
<br />
    * Have an inline element start on a new line<br />
    * Have a block element start on the same line<br />
    * Control the width of an inline element (particularly useful for navigation links)<br />
    * Manipulate the height of an inline element<br />
    * Set a background colour as wide as the text for block elements, without having to specify a width<br />
<br />
2. Another Box Model Hack Alternative<br />
<br />
The box model hack is used to fix a rendering problem in pre-IE 6 browsers on PC, whereby the border and padding are included in, rather than added onto, the width of an element. A number of CSS-based solutions have been put forward to remedy this; here's another one that I really like: <br />
<br />
<br />
Quote:padding: 2em; border: 1em solid green; width: 20em; width/**/:/**/ 14em;<br />
<br />
<br />
The first width command is read by all browsers; the second by all browsers except IE5 [4].x on PC. Because the second command comes second, it takes precedence over the first: any command that comes second will always override a preceding command. So, how does all this work?<br />
<br />
By placing empty comment tags (/**/) before the colons, we instruct IE5.0 to ignore the command. Likewise, if we place empty comment tags after the colon, IE5.5 will ignore the command. Using these two rules in conjunction with each other, we can hide the command from all of IE5.x browsers.<br />
<br />
3. Minimum Width for a Page<br />
<br />
A very handy CSS command that exists is the min-width command, whereby you can specify a minimum width for any element. This can be particularly useful for specifying a minimum width for a page.<br />
<br />
Unfortunately, IE doesn't understand this command, so we'll need to come up with a new way of making this functionality work in this browser. First, we'll insert a  under the  tag, as we can't assign a minimum width to the : <br />
<br />
<br />
Quote:<br />
<br />
<br />
Next, we create our CSS commands, to create a minimum width of 600px:<br />
<br />
Quote:#container<br />
{<br />
min-width: 600px;<br />
width:expression(document.body.clientWidth < 600? "600px":"auto" );<br />
}<br />
<br />
<br />
The first command is the regular minimum width command; the second is a short JavaScript command that only IE understands. Do note, though, that this command will cause your CSS document to become invalid; you may prefer to insert it into the head of each HTML document to get around this.<br />
<br />
You might also want to combine this minimum width with a maximum width: <br />
<br />
Quote:#container<br />
{<br />
min-width: 600px;<br />
max-width: 1200px;<br />
width:expression(document.body.clientWidth < 600? "600px" : document.body.clientWidth > 1200? "1200px" : "auto"); }<br />
<br />
<br />
4. IE and Width and Height Issues<br />
<br />
IE has a rather strange way of doing things. It doesn't understand the min-width and min-height commands, but instead interprets width and height as min-width and min-height -- go figure!<br />
<br />
This can cause problems, because we may need boxes to be resizable should we need to fit more text into them, or should the user resize the text. If we use only the width and height commands on a box, non-IE browsers won't allow the box to resize. If we only use the min-width and min-height commands, though, we can't control the width or height in IE!<br />
<br />
This can be especially problematic when using background images. If you're using a background image that's 80px wide and 35px high, you'll want to make sure that the default size for a box using this image is exactly 80 x 35px. However, if users resize the text, the box size will need to expand gracefully.<br />
<br />
To resolve this problem, you can use the following code for a box with class="box": <br />
<br />
<br />
Quote:.box<br />
{<br />
width: 80px;<br />
height: 35px;<br />
}<br />
<br />
html>body .box<br />
{<br />
width: auto;<br />
height: auto;<br />
min-width: 80px;<br />
min-height: 35px;<br />
}<br />
<br />
<br />
All browsers will read through the first CSS rule, but IE will ignore the second rule because it makes use of the child selector command. Non-IE browsers will read through the second one, which will override the values from the first rule, because this CSS rule is more specific, and CSS rules that are more specific always override those that are less specific.<br />
<br />
5. Text-transform Command<br />
<br />
One of the lesser known, but really useful CSS commands is the text-transform command. Three of the more common values for this rule are: text-transform: uppercase, text-transform: lowercase and text-transform: capitalize. The first rule turns all characters into capital letters, the second turns them all into small letters, and the third makes the first letter of each word a capital letter.<br />
<br />
This command is incredibly useful to help ensure consistency in style across an entire Website, particularly if it has a number of content editors. Say for example your style guide dictates that words in headings must always begin with capital letters. To ensure that this is always the case, use text-transform: capitalize. Even if site editors forget about the capitalisation, their mistake won't show up on the Website. <br />
<br />
It's also preferable to use text-transform: uppercase to capitalise words, as screen readers may pronounce shorter words in capital letters as acronyms. A great example of this is 'CONTACT US', which is pronounced as 'contact US' by some screen readers.<br />
<br />
6. Disappearing Text or Images in IE?<br />
<br />
IE exhibits a very strange bug whereby text or background images sometimes disappear from sight. These items are still actually present and, if you highlight everything on screen or hit refresh, they'll often re-appear. Kind of strange, huh?<br />
<br />
This problem mostly occurs on background images and on text positioned next to a floated element. To remedy the problem, simply insert position: relative into the CSS command for the disappearing element, and for some bizarre reason, that'll usually fix the problem. If this doesn&339;t work (and sometimes, it doesn't), assign a width to the offending element in the CSS -- that should fix the problem.<br />
<br />
7. Invisible Text<br />
<br />
Sometimes, you may actually want to make text invisible. Invisible text can be especially useful for screen reader users, perhaps to assign a label to a form item, or insert a heading ahead of a section. Don't want to change the visual appearance by inserting these elements? Make them invisible, and no one using a visual browser will know they're there.<br />
<br />
You may also want to make text invisible if using a print or handheld CSS file, as some information may not need to be displayed on either of these mediums (see below for more on this).<br />
<br />
To make text invisible, you can use display: none -- easy! This works fine for hiding text from handhelds (if CSS is supported) and printed Web pages, but isn't so great for many screen readers. Screen readers are now becoming too clever for their own good, and some will actually ignore any text that has the rule display: none assigned to it.<br />
<br />
Therefore, for screen readers users, a new approach is needed: position: absolute; left: -9000px. This basically takes the text and positions it 9000px to the left of the left edge of the screen, essentially making it invisible.<br />
<br />
8. CSS Document for Handhelds<br />
<br />
A separate CSS document can be created for PDAs and mobile phones, and activated only when one of these devices is being used to access your site. More and more Websites are creating separate CSS documents for printing, so Web pages automatically become print-friendly when users choose to print them. You can do the same for handheld devices.<br />
<br />
The following command is used to call up the CSS document for handhelds: <br />
<br />
<br />
Quote:<br />
<br />
<br />
CSS commands in the handheld CSS file override any equivalent commands in the main CSS document. So, what commands should you place in this file? Ideally, you want users of handheld devices to avoid having to scroll horizontally.<br />
<br />
To test this, open up your Website in a regular browser window and resize it to 150px in width. Then, open up your main CSS file and insert some new commands at the very bottom of the document. The commands you place here should adjust the layout of the Website so that it doesn't require horizontal scrolling at a width of 150px. Then, open up a new document, cut and paste these new commands over, and save it as handheldstyle.css (or whatever name you want to give it).<br />
<br />
Your Websites offering to users of handheld devices should be quite different to its offering to traditional Web browsers, as the user experience is quite different on a handheld device. For further information, a book such as "Handheld Usability", by S.W. Weiss, is a great read.<br />
<br />
9. 3-d Push Button Effect<br />
<br />
Back in the early days of the Web, 3-d buttons that appeared to become pushed in when moused over were all the rage. At that time, this could only be achieved through images and JavaScript, but now, with the advent of CSS, we can go retro and re-create this 3-d effect.<br />
<br />
The main CSS commands you'll need are: <br />
<br />
Quote:a {<br />
display: block;<br />
border: 1px solid;<br />
border-color: #aaa #000 #000 #aaa;<br />
width: 8em;<br />
background: #fc0;<br />
}<br />
<br />
a:hover<br />
{<br />
position: relative;<br />
top: 1px;<br />
left: 1px;<br />
border-color: #000 #aaa #aaa #000;<br />
}<br />
<br />
<br />
Aside from these commands, you can insert other commands to achieve the desired presentation effect -- the only limit is your imagination!<br />
<br />
10. Same Navigation Code on Every Page<br />
<br />
Most Websites highlight the navigation item relating to each user's location within the Website, to help users orientate themselves. This is a fundamental requirement for basic usability, but it can be a pain: we need to tweak the HTML code behind the navigation for each and every page. Can we have the best of both worlds? Is it possible to have the navigation highlighted on every page, without having to tweak the HTML code on every page? Of course it is!<br />
<br />
First of all, you'll need to assign a class to each navigation item: <br />
<br />
Quote:<br />
Home<br />
About us<br />
Contact us<br />
<br />
<br />
<br />
You'll then need to insert an id into the  tag. The id should be representative of where users are located in the site, and should change when users move to a different site section. When on the 'Home' page, it should read , in 'About Us', it should read , and in 'Contact Us', .<br />
<br />
Next, you create a new CSS rule:<br />
<br />
Quote:#home .home, #about .about, #about .about, #contact .contact<br />
{<br />
commands for highlighted navigation go here<br />
} <br />
<br />
<br />
This basically creates a rule that only takes effect when class="home" is contained within id="home", and when class="about" is in id="about" and class="contact" is in id="contact". These situations will only occur when the user is in the appropriate section of the site, seamlessly creating our highlighted navigation item.]]></content:encoded>
		</item>
	</channel>
</rss>