May 4th, 2008
Its a very simple way of changing css class using php, all you have to do is to run a for loop and each loop it will change the class.

First we define css classes as gray blue green and black, and we’ll use it in table using php.
<html>
<title>Changing CSS class through PHP - Demo</title>
<head>
<style>
.gray{background-color:red; color:white;font-size:20px; font-weight:bold; }
.blue{background-color:blue; color:white;font-size:20px; font-weight:bold; }
.green{background-color:green; color:white;font-size:20px; font-weight:bold; }
.black{background-color:black; color:white;font-size:20px; font-weight:bold; }
</style>
</head>
<body>
<table width=”500″ border=”6″ cellspacing=”6″ cellpadding=”6″ >
<?php
for($row=1; $row<=10; $row++)
{ echo “<tr>”;
for($column=1; $column<=4; $column++)
{
switch($column){
case 1: $class=”gray”; break;
case 2: $class=”blue”; break;
case 3: $class=”green”; break;
default: $class=”black”;
}
echo “<td class=\”$class\” align=\”center\”>[$row,$column]</td>”;
}
echo “</tr>”;
}
?>
</table>
</body>
Posted in CSS, PHP | 1 Comment »
May 4th, 2008
Its a very simple css code, and creat a shaded like affect using multiple borders. It has 7 borders with blending shades.

<html>
<head>
<style>
html,body{ margin:0; padding:0; text-align:center; height:100%;}
#sh1{ margin:0 auto; width:800px; border-left:1px solid #fdfdfd; border-right:1px solid #fdfdfd;text-align:left; height:100%;_margin-right:-3px; }
#sh2{ border-left:1px solid #f8f8f8;border-right:1px solid #f8f8f8;height:100%}
#sh3{border-left:1px solid #f1f1f1;border-right:1px solid #f1f1f1; height:100%}
#sh4{border-left:1px solid #e7e7e7;border-right:1px solid #e7e7e7;height:100%}
#sh5{border-left:1px solid #dadada;border-right:1px solid #dadada; height:100%}
#sh6{border-left:1px solid #cacaca;border-right:1px solid #cacaca;height:100%}
#sh7{border-left:1px solid #eaeaea;border-right:1px solid #eaeaea;height:100%}
</style>
</head>
<body>
<div id=”sh1″>
<div id=”sh2″>
<div id=”sh3″>
<div id=”sh4″>
<div id=”sh5″>
<div id=”sh6″>
<div id=”sh7″>
Your Content goes here..<br />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
The advantage of using this method over using images is that you can easily change the width of your site without changing the background image.
Posted in CSS, Windows | 4 Comments »
May 3rd, 2008
You can configure linux as firewall in several ways, depends on your requirements and your network size. The easiest way is to use iptables (packet filtering) if you have a simple network or a few computers. There are other methods like pf and ipfw etc but they are quite complex to setup as you’ll need them if you have huge network or inhouse servers like web servers, email server, dns server etc with huge amount of traffic.
For for basic and simplicity we’ll use iptables as it is very easy to setup and troubleshoot, also we’ll setup this linux box to do NAT (network address translation) as well, means it will share internet with other computers.
I will setup packet filtering firewall for the following diagram

Here linux which acts as firewall and do NAT as well. If you to Linux box to assign IP to your computer you’ll need to install DHCP service, or you can assign IPs manually if you do not want DHCP server. In either case your workstations will have these TCP/IP settings.
i.e.
Workstation1
IP: 192.168.1.21
Subnetmask: 255.255.255.0
Gateway: 192.168.1.10
DNS: If you are using a router/DSL modem then DNS ip is the IP of your Router i.e. 192.168.1.1, if you are using cable modem then it will be the Public DNS IP which is 194.168.4.100 other wise if can give it the IP of linux machine if this linux box is a dns server as well. You’ll two Ethernet Cards, connect the first ethernet card (eth0) to your Switch and the second ethernet card (eth1) to your router or cable modem. Set eth1 to get IP automatically from router or cable modem and type ifconfig eth1 Let say IP assigned by router to eth1 is 192.168.1.2
Read the rest of this entry »
Posted in Linux | No Comments »
May 1st, 2008
Postfix is an MTA (Mail Transfer Agent) for sending and receiving emails. It was developed due to the short coming found in Sendmail. The difference between the Postfix and Sendmail is that Postfix is very easy to install and configure, while sendmail on the other hand is a bit hard to work with and difficult to troubleshoot. The reason behind this is that sendmail is a single process or single binary which combines all its functions and modules built in it, so this single daemon should always be running. Postfix comes with different independent modules, responsible for delivery routing messaging and filtering etc. these modules are separate entity independent of postfix such as SMTP client, SMTP Daemon, and applications like cleanup, trivial re-write, queue manager (qmgr), pipe, local, pickup and maildrop, all interacting with each other to make a fully fledged email server.
Post has support for Regular expression such as Perl regular expression which we’ll talk about it later in this article.
Postfix Block Diagram
The image below show the email delivery process both local and remote messages.

Read the rest of this entry »
Posted in Linux | No Comments »
April 17th, 2008
if you see the above error message while compiling an application from source code ./configure
it means you dont have flex installed on your machine so install it using yum
[root@localhost ~]#yum install flex
and then try to run ./configure command, will work!
Posted in PHP | 1 Comment »
April 16th, 2008
Internet, Computers and Networks are merging in our real lives so rapidly that everything is now depended on it. The more things are merging into computers and internet the more it become unsecured. Internet is a blind world you can’t trust on any thing, even if you are communicating with your family on internet or receiving a file from your friends, you can’t trust the file being sent or your communication, as they might interrupted by a third person sitting in the middle of you communication and monitoring your packets.
You have to be very careful while using internet, especially for sensitive stuff, like credit card transactions, buying something online, or sharing your personal data. There can be hackers who are spying your internet activities, or viruses that slowed down your computer or messed up your computer behavior and lots of other malicicious programs like Spywares, Trojans, Adwares, Worms and rootkits. All these malicious softwares are also called as malware (MALicious softWARE). Lot of people miss use the concept of these programs, they all call it a virus, which are different due to their behavior and their influence.
Read the rest of this entry »
Posted in Windows | No Comments »
April 14th, 2008
You can install mysql using the following methods
- Installing mysql from Source tar.gz files
- Installing mysql from Binary .rpm file, either
- from CD, or
- using yum utility
- You can select to install mysql during Linux Installation Setup
But I would recommend you to Compile and install it from source files, as you can compile it using your own settings (include or exclude options). Read the rest of this entry »
Posted in Mysql | 3 Comments »
April 13th, 2008
yum, also called Yellow dog Updater Modified, is a Linux utility which is use to install RPM packages/Binary Files (.rpm files). You can use yum with the following options
Posted in Linux | 1 Comment »
April 13th, 2008
if you are trying to locate files in linux and you get such errors
[root@localhost /]# locate openssl
locate: can not open `/var/lib/mlocate/mlocate.db’: No such file or directory
type updatedb to fix this problem
[root@localhost /]#updatedb
Posted in Windows | 4 Comments »
April 10th, 2008
Could not expand chunk pool for ipnat node. No memory available
-Process= "Chunk Manager", ipl= 4, pid= 1
-Traceback= 0x80137D24 0x8028E1FC 0x802937F0 0x802AD8B8 0x802AC97C 0x802AC6F4 0x
8027E0F8 0x80281720
17:37:32: %SYS-2-CHUNKEXPANDFAIL: Could not expand chunk pool for ipnat node. No
memory available
-Process= "Chunk Manager", ipl= 4, pid= 1
-Traceback= 0x80137D24 0x802AC73C 0x8027E0F8 0x80281720
-Traceback= 0x80137D24 0x802AC73C 0x8027E0F8 0x80281720
17:37:58: %SYS-2-MALLOCFAIL: Memory allocation of 65536 bytes failed from 0x802A
D8B4, alignment 8
Pool: Processor Free: 4719952 Cause: Memory fragmentation
Alternate Pool: None Free: 0 Cause: No Alternate pool
You will see these messages in your log when your router hasn’t got enough memory to allocate for more Dynamic NAT.
check your NAT statistics
Read the rest of this entry »
Posted in cisco | No Comments »