Explore Yourself !!!


JQuery : Easy way to learn

Well, till now i am not familiar about Jquery. months back, during discussion i told an expert programmer that, i don’t know Jquery. and he replied: “Don’t worry about JQuery. JQuery is Designer stuff not developer but it’s nice to know how to integrate and it works”.

As though, i am really lazy one i can’t start learning Jquery upto yesterday. But today is good time for me to learn jquery stuff. So here is my index of learning:

1. Understand basic concept of JQuery.
2. Integrate JQuery in a simple scratch build php page(registration.php)
3. Integrate JQuery in Code Igniter
4. Integrate JQuery in Symfony.

1. Understand basic concept of JQuery.
Well, jquery is nothing but a helpful file. which means that, first i need to dowload jquery.js file and put it somewhere in my project. now, most popular thing is form validation. to validate a form what we need is, first download jquery.validate.js file. moreover, here is a list of validation stuffs.
http://docs.jquery.com/Plugins/Validation

2. Integrate JQuery in a simple scratch build php page(registration.php)
<html>
<head>
<script src=”jquery-1.3.2.min.js”></script>
<script src=”jquery.validate.js”></script>
<script>
$(document).ready(function(){
$(“#commentForm”).validate();
});
</script>
</head>

<body>

<form id=”commentForm” method=”post” action=”test.php”>
<fieldset>
<legend>A simple comment form with submit validation and default messages</legend>
<p>
<label for=”cname”>Name</label>
<em>*</em><input id=”c_name” name=”name” size=”25″ class=”required” />
</p>
<p>
<label for=”cemail”>E-Mail</label>
<em>*</em><input id=”cemail” name=”email” size=”25″ class=”required email” />
</p>
<p>
<label for=”ccomment”>Your comment</label>
<em>*</em><textarea id=”ccomment” name=”comment” cols=”22″ class=”required”></textarea>
</p>
<p>
<label for="cbd">Birthday</label>
<em>*</em><input id="cbd" name="cbd" size="25" class="required date" />
</p>
<p>
<label for="curl">URL</label>
<em> </em><input id="curl" name="url" size="25" class="url" value="" />
</p>

<p>
<input class=”submit” type=”submit” value=”Submit”/>
</p>
</fieldset>
</form>
</body>
</html>

3. Integrate JQuery in Code Igniter:
It’s surprising for me, according to my plan i go over CI forum and search “how to integrate Jquery with CI” i found that, there are nothing special !! it’s really simple and easy. nothing special. only the difference for me is that, i use master template concept now i days. where my view file is not as usual even for write which css and js files will include there are a specific page. this kind of splliting(part of master page concept) have huge advantage over conventional. i shall write that in some other days. so i integrate jquery js files there and in my main page i add the following script(for registraton validation):
<script>
$(document).ready(function(){
$(“#commentForm”).validate();
});
</script>

4. Integrate JQuery in Symfony:
Will be exactly same as CI. because both follow MVC pattern. so no worry about Symfony as well.

End of the day, first time in my life i do something in time according to my plan ;) Enjoy Jquery :)



.htaccess file for server and localhost
April 25, 2009, 10:24 am
Filed under: Code Igniter | Tags: , ,

it’s really shame to say, having working experience of around 1 and 1/2 year in code igniter i forget how to use .htaccess for localhost. honestly, i have no problem with .htaccess(for localhost and server) when environment configured as “Port based WAMP server”. however, before i forget let me write

There are two ways of environment setup. You can either configure your PHP, MySql, Apache as General/Conventional way or “Port based”. Both are fine and just a matter of different taste. I feel, no one have huge advantage over other. To give you an idea, say our project name is aminul_fool. In genearl way we create a folder in our root/htdocs/www and browse project as http://localhost/aminul_fool. On the other hand, when your choice port based setup then you can put your project (aminul_fool) anywhere of your computer(not necessary to put it into your web root) and configure port from /bin/apache/apache2.2.8/conf/httpd.conf and lastly browse your project as http://localhost:420.

Make sure your you activate rewrite_module feature. If you use WAMP then to do so, first run wamp server. and left click
wamp (white icon) -> apache -> apache modules-> rewrite_module(put tick mark)
now your server is totally able to handle .htaccess request.

Well, .htaccess file contenet is completely different for different type of environemnt you choose. If you choose conventional way then here is the .htaccess file content

Options +FollowSymLinks
DirectoryIndex index.php
RewriteEngine On
RewriteRule ^\.htaccess$ – [F]
RewriteRule ^favicon\.ico – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /aminul_fool/index.php?/$1 [L]

And when it’s Port based environment setup or Web Server(www.aminul_fool.com) here is the .htaccess file content

Options +FollowSymLinks
DirectoryIndex index.php
RewriteEngine On
RewriteRule ^\.htaccess$ – [F]
RewriteRule ^favicon\.ico – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]

That’s all !! Restart wamp(for localhost) and enjoy restful url like:
http://localhost/aminul_fool/controller_novice/function_sumon

and for your server (aminul_fool.com)
http://www.aminul_fool.com/controller_novice/function_sumon



Mail goes to Spam for Yahoo Recipient [Solved]
April 21, 2009, 11:26 am
Filed under: LAMP | Tags: , , , , ,

It’s a good experience for me. i have posted the problem elsewhere as well. let me copy and paste that one first. http://www.bluehostforum.com/showthread.php?p=68607#post68607

last 2 days i have spent couple of hours to resolve an issue of mail sending. here is my code of php

Finally PHP Code:
<?php
include_once('class.phpmailer.php');
$mail             = new PHPMailer(); // defaults to using php "mail()"

$body = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';
$body             = eregi_replace("[\]",'',$body);

$mail->From       = "webmaster@shopno-dinga.com";
$mail->FromName   = "Shopno Dinga";
$mail->Subject    = "PHPMailer Test Subject via mail()";
$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$mail->AddAddress("aminulsumon@yahoo.com", "hello faruk");
//$mail->AddAttachment("images/phpmailer.gif");             // attachment
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}

?>

my script doesn’t show any error. it’s able to send mail to gmail and hotmail inbox. but only for yahoo it goes spam folder. i don’t think that, it’s an issue of yahoo.

Please note that, webmaster@shopno-dinga.com email address is created through cpanel.
I ask some friends to resolve it. Someone says, use @, some one say’s seems to him ok and one says, go google and search phpmailer(he is the busiest one ;) ). however, i have tried to implement phpmailer one and i get success. It’s easy to implement. a very simple php class and set some value. that’s all.

phpmailer site: http://phpmailer.codeworxtech.com/
donwload link: http://sourceforge.net/project/showfiles.php?group_id=26031&package_id=252700 and click PHPMailer v2.3 for PHP5/6

PHP Code:

$subject = 'Birthday Reminders for August';

// message
$message =
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
;
$subject = ‘Birthday Reminders for August’;
$to = ‘aminulsumon@yahoo.com’;
$headers=‘MIME-Version: 1.0′.“\r\n”;
$headers.=‘Content-type: text/html; charset=iso-8859-1′.“\r\n”;
$headers.=‘To: Aminul <aminulsumon@yahoo.com>’.“\r\n”;
$headers.=‘From: Shopno dinga <webmaster@shopno-dinga.com>’.“\r\n”;
mail($to, $subject, $message, $headers);

And Still same result. Mail goes to spam folder for yahoo !!!

Well, lets analyze with this simple code

&lt;?php
$to = 'aminulsumon@yahoo.com';
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: Aminul Sir &lt;aminulsumon@yahoo.com&gt;' . "\r\n";
$headers .= 'From: Dinga &lt;webmaster@shopno-dinga.com&gt;' . "\r\n";
$headers .= 'Reply-To: webmaster@shopno-dinga.com' . "\r\n";

$message = 'very simple mail. only text no html currently.';
$subject = 'test mail from manktech';

if(mail($to, $subject, $message, $headers))
echo "mail goes to $to \r\n";
else
echo 'mail jai nai.';
?&gt;

Please note that, from some hosting(i think those are first class domain) this code is able to send yahoo recipient mail in their inbox but still not from my hosting(bluehsot) :(

Debugging Starts: First check whether your domain is blacklisted or not. Check through http://www.mxtoolbox.com/ site.
=>checked and try to fix many ways but still mail goes to spam for yahoo recipient.

Well, after couple of days, i get only person who is able to provide me proper explanation. Most of the professionals reply as, “It’s completely header issue. so try to fix that and it will work”. but when i request himself to change he failed. someone point his finger to use third party emailer but after implement when i knock them “Still it’s spam”. they have no proper explanation. i found less people who say “Sorry brother can’t understand what actually going on”. Well, only one friend reply the real fact. He said “Yes, yahoo have some additional filtering and that’s why mail from all domain are not accepted and goes spam. But google have an excellent service which will overcome spam issue.” here is his mail’s reply:

At the following links given below has all mx server installation with domain name & hosting features by google apps migration service management for developers, i think it would be best to test the yahoo mail service with other domain with less finance cost.

and finally i do a good RnD. simple few steps configuration. Most importantly, MX Entry configuration. keep in mind, it’s in your cpanel not at your domain control panel(by example, godaddy.com). Finally, i am able to create email account which is fully featured of gmail. :) yes it’s surprising. exactly same outlooking and features(by example, google doc, calendar) of gmail.

Now i am able to access my email from https://www.google.com/a/cpanel/shopno-dinga.com using username :admin@shopno-dinga.com and password: something.

This tutorial may be helpful for someone who is interested to learn mail stuffs with proper explanation. And it’s really charming to get gmail features for your domain email accounts. Best of luck :)



One shot symfony install
April 11, 2009, 10:53 pm
Filed under: Symfony | Tags: ,

First install WAMP. you can also choose XAMP but for me it’s WAMP.

to install symfony you need to enable or install pear. follow this link in order to do it:

http://trac.symfony-project.org/wiki/HowToInstallPearOnWindowsWithWamp

REBOOT PC

second step is to install symfony
http://trac.symfony-project.org/wiki/HowToInstallSymfonyOnWindowsWithWamp

REBOOT PC

Dont worry if your C:\>symfony does not show anything. it’s important to make sure that, there are no error.

Now you are ready to start symfony. First download symfony package from http://symfony-project.org/ or theiir SVN. I prefer svn one.

Enjoy Symfony!!!!



Ubuntu: Install and Configure Network / Internet
April 8, 2009, 11:23 pm
Filed under: LAMP | Tags: , ,

Finally i purchase a second hand but fresh condition laptop with 26K, here is it’s configuration: Toshiba Sattelite L300, Intel Celeron 2.0 GHz, HDD: 80GB, Display 15.4 inc, RAM: 1 GB, Used: 8 month.

So it require me to setup internet and here are the steps to setup network. Note that my mac address is: 00:13:D3:9E:65:7F. First install fedora operating system and follow these steps.

LINUX COMMANDS(For Ubuntu Network Setup)
====================================================

#sudo update-rc.d -f NetworkManager remove
=> Remove default connection.

#sudo nano /etc/network/interfaces
=> Enter the following configuration(change according to your configuration)
auto eth0
iface eth0 inet static
address 192.168.2.155
netmask 255.255.255.0
gateway 192.168.2.1
hwaddress ether 00:13:D3:9E:65:7F

#sudo nano /etc/resolv.conf
Entere here the following informations(Pref DNS):
nameserver 192.168.2.1

#sudo /etc/init.d/networking restart
=>to avoid reboot pc/laptop

Debugging:—>

#iptables -F
=> Flash Firewall

#ifconfig
=> display current configuration

Still not working?? Don’t worry Reboot Your pc….. Still not working? I am sorry but search in google :)

ENJOY UBUNTU !!!!!!