<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5500905858342488116</id><updated>2024-11-08T07:40:44.808-08:00</updated><title type='text'>PHP Development</title><subtitle type='html'>Web development help ,joomla help,php help, mysql help, Open source tutorials</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>39</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-2589306674585323750</id><published>2013-11-23T04:01:00.001-08:00</published><updated>2013-11-23T04:04:09.501-08:00</updated><title type='text'>Enable poshy tooltip in append html</title><content type='html'>Poshytool tip in append html&lt;br /&gt;
    &lt;br /&gt;
  If we are appending some html elements to existing html, the poshy tool tip will not work.&lt;br /&gt;
  &lt;br /&gt;
  Here is the code to overcome such issue&lt;br /&gt;
  
&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;
&lt;br /&gt;
$(document).ready(function() {&lt;br /&gt;
&lt;br /&gt;
$( document ).on( &quot;mouseout&quot;, &quot;.fc-event&quot;, &lt;br /&gt;
function() {&lt;br /&gt;
var reqUrl = $(this).attr(&#39;href&#39;);&lt;br /&gt;
showThemeKeyowrds(this,reqUrl)&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
$( document ).on( &quot;mouseleave&quot;, &quot;.fc-event&quot; ,&lt;br /&gt;
function() {&lt;br /&gt;
$(&quot;div [class^=&#39;quickcont_popup&#39;]&quot;).poshytip(&#39;hide&#39;);&lt;br /&gt;
})  ;&lt;br /&gt;
&lt;br /&gt;
});&lt;br /&gt;
var ajaxtooltip = {};&lt;br /&gt;
function showThemeKeyowrds(ele,reqUrl)&lt;br /&gt;
{&lt;br /&gt;
$(&quot;div [class^=&#39;fc-event&#39;]&quot;).poshytip(&#39;hide&#39;);&lt;br /&gt;
$(ele).poshytip({&lt;br /&gt;
liveEvents: true,&lt;br /&gt;
content: function(updateCallback) {&lt;br /&gt;
&lt;br /&gt;
var rel = reqUrl;&lt;br /&gt;
&lt;br /&gt;
if (ajaxtooltip[rel] &amp;amp;&amp;amp; ajaxtooltip[rel].container)&lt;br /&gt;
return ajaxtooltip[rel].container;&lt;br /&gt;
if (!ajaxtooltip[rel]) {&lt;br /&gt;
ajaxtooltip[rel] = { container: null };&lt;br /&gt;
&lt;br /&gt;
var params = &quot;?url&quot;+rel;&lt;br /&gt;
var url = MAIN_URL+&quot;smb/calendar/eventtooltip&quot;+params ;&lt;br /&gt;
$.get(url,&lt;br /&gt;
function(data) {&lt;br /&gt;
var container = $(&#39;&amp;lt;div/&amp;gt;&#39;).html(data);&lt;br /&gt;
&lt;br /&gt;
// call the updateCallback function to update the content in the main tooltip&lt;br /&gt;
// and also store the content in the cache&lt;br /&gt;
updateCallback(ajaxtooltip[rel].container = container);&lt;br /&gt;
}&lt;br /&gt;
);&lt;br /&gt;
}&lt;br /&gt;
return &#39;Loading...&#39;;&lt;br /&gt;
},&lt;br /&gt;
className: &#39;tip-darkgray&#39;,&lt;br /&gt;
bgImageFrameSize: 11,&lt;br /&gt;
alignY: &#39;bottom&#39;,&lt;br /&gt;
});
  &lt;br /&gt;
$(ele).poshytip(&#39;show&#39;);&lt;br /&gt;
  }&lt;br /&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/2589306674585323750/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2013/11/enable-poshy-tooltip-in-append-html.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/2589306674585323750'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/2589306674585323750'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2013/11/enable-poshy-tooltip-in-append-html.html' title='Enable poshy tooltip in append html'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-7151220756066783901</id><published>2011-11-03T23:52:00.000-07:00</published><updated>2011-11-04T00:02:45.112-07:00</updated><title type='text'>Simple way to change the records order</title><content type='html'>Simple way to change the records order&lt;br /&gt;
&lt;br /&gt;
Many times we have the need to change the table records order. Joomla is an example. In joomla, many modules has the feature to change the order of the records.&lt;br /&gt;
&lt;br /&gt;
Here is an example of ordering the table records. Also added the code if we want to add a record into a particular position.&lt;br /&gt;
&lt;br /&gt;
Assume that there is a table &#39;f_users&#39; and it has fields like users_id,user_pos . We are considering this only :).&lt;br /&gt;
&lt;br /&gt;
First of all, we are listing the records based on user_pos. And add the links for &#39;up&#39; and &#39;down&#39; . &lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;&lt;b&gt;Source code&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;codedisplay&quot;&gt;&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
// data base connection codes&lt;br /&gt;
&lt;p&gt;extract($_GET);&lt;/p&gt;&lt;p&gt;// create a new user to the particular position&lt;br /&gt;
&lt;br /&gt;
//  ************ New user creation section starts *******************&lt;br /&gt;
&lt;br /&gt;
if(isset($action))&lt;br /&gt;
{&lt;br /&gt;
// assume that the position is 5&lt;br /&gt;
$position = 5;&lt;br /&gt;
// increment the position by 1 if the user position is greater than 5&lt;br /&gt;
mysql_query(&amp;quot;UPDATE f_users SET user_pos=user_pos+1 WHERE user_pos &amp;gt;= $position&amp;quot;);&lt;br /&gt;
// inserting new user&lt;br /&gt;
mysql_query(&amp;quot;insert into f_users(users_name,user_pos) values(&#39;blabla&#39;,$position)&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
//  ************ New user creation section enda *******************&lt;br /&gt;
&lt;br /&gt;
if(isset($move))&lt;br /&gt;
{&lt;br /&gt;
switch($move)&lt;br /&gt;
{&lt;br /&gt;
case &#39;up&#39;:&lt;br /&gt;
// this has to move to top&lt;br /&gt;
$base = $id;&lt;br /&gt;
// find the top one&lt;br /&gt;
$prevOne = mysql_result(mysql_query(&amp;quot;SELECT MAX(user_pos) FROM f_users WHERE user_pos &amp;lt; $base &amp;quot;),0);&lt;br /&gt;
// swapping the values&lt;br /&gt;
&lt;br /&gt;
mysql_query(&amp;quot;UPDATE f_users SET user_pos = CASE user_pos WHEN $base THEN $prevOne WHEN $prevOne THEN $base END WHERE user_pos IN ($base, $prevOne)&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
break;&lt;br /&gt;
case &#39;down&#39;:&lt;br /&gt;
// this has to move down&lt;br /&gt;
$base = $id;&lt;br /&gt;
// find the bottom one&lt;br /&gt;
$nextOne = mysql_result(mysql_query(&amp;quot;SELECT MIN(user_pos) FROM f_users WHERE user_pos &amp;gt; $base &amp;quot;),0);&lt;br /&gt;
// swapping the values&lt;br /&gt;
mysql_query(&amp;quot;UPDATE f_users SET user_pos = CASE user_pos WHEN $base THEN $nextOne WHEN $nextOne THEN $base END WHERE user_pos IN ($base, $nextOne)&amp;quot;);&lt;br /&gt;
break;&lt;br /&gt;
default:&lt;br /&gt;
break;&lt;br /&gt;
}&lt;br /&gt;
}&lt;/p&gt;&lt;p&gt;$first = mysql_result(mysql_query(&amp;quot;SELECT MIN(user_pos) FROM f_users &amp;quot;),0);&lt;br /&gt;
$last = mysql_result(mysql_query(&amp;quot;SELECT MAX(user_pos) FROM f_users &amp;quot;),0);&lt;br /&gt;
$res = mysql_query(&amp;quot;select users_id,user_pos FROM f_users ORDER BY user_pos&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;table width=&amp;quot;26%&amp;quot; border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td width=&amp;quot;18%&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td width=&amp;quot;39%&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td width=&amp;quot;43%&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;?php &lt;br /&gt;
while($row = mysql_fetch_array($res))&lt;br /&gt;
{&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;?php echo $row[&#39;users_id&#39;]; ?&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;?php echo $row[&#39;user_pos&#39;]; ?&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;?php &lt;br /&gt;
if($row[&#39;user_pos&#39;]!=$first)&lt;br /&gt;
echo &#39;&amp;lt;a href=&amp;quot;?move=up&amp;amp;id=&#39;.$row[&#39;user_pos&#39;].&#39;&amp;quot;&amp;gt;Up&amp;lt;/a&amp;gt;&#39;;&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&lt;br /&gt;
&amp;lt;?php &lt;br /&gt;
if($row[&#39;user_pos&#39;]!=$last)&lt;br /&gt;
echo &#39;&amp;lt;a href=&amp;quot;?move=down&amp;amp;id=&#39;.$row[&#39;user_pos&#39;].&#39;&amp;quot;&amp;gt;down&amp;lt;/a&amp;gt;&#39;;&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;?php &lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;a href=&amp;quot;?action=adduser&amp;quot;&amp;gt;add user&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt; &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/7151220756066783901/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2011/11/simple-way-to-change-records-order.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/7151220756066783901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/7151220756066783901'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2011/11/simple-way-to-change-records-order.html' title='Simple way to change the records order'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-4810090566516160704</id><published>2011-08-29T03:19:00.000-07:00</published><updated>2011-08-29T03:19:34.635-07:00</updated><title type='text'>JFolder::create: Could not create directory</title><content type='html'>JFolder::create: Could not create directory&lt;br /&gt;
Warning! – Failed to move file&lt;br /&gt;
Unable to find install package&lt;br /&gt;
&lt;br /&gt;
If we get this error while installing a joomla plugin, it may because of the path in the configuration file. This issue is mainly when we are copying the joomla site into another domain and not changing the path of the configuration file.If the value of these variables are not existing path, the installation wont works. It may be absolute or relative path.&lt;br /&gt;
&lt;br /&gt;
var $log_path = &#39;/tmp&#39;;&lt;br /&gt;
var $tmp_path = &#39;/var&#39;;&lt;br /&gt;
&lt;br /&gt;
These two paths should be the existing paths.</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/4810090566516160704/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2011/08/jfoldercreate-could-not-create.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/4810090566516160704'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/4810090566516160704'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2011/08/jfoldercreate-could-not-create.html' title='JFolder::create: Could not create directory'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-1385461269911999493</id><published>2011-03-14T21:13:00.000-07:00</published><updated>2011-03-14T21:13:51.428-07:00</updated><title type='text'>How to select the timezone using php</title><content type='html'>In PHP we can find the server time using the date(). But it returns the time of the server where it located. If our website users are from different country we need to display the correct country time instead of server time. If we want to display the local time of a users browsing your webpage, we must find the timezone of the user. If we know the timezone we can find the time of the user timezone. We can list the timezones in a select box and if the user selects the timezone we can find the time of the timezone. In this example it shows how to get the user timezone times.&lt;br /&gt;
&lt;br /&gt;
Step 1 : List the timezones&lt;br /&gt;
The &#39;DateTimeZone::listIdentifiers() &#39; function returns the timezones and we can iterate the timezones.&lt;br /&gt;
To get the timezones use the following code&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&amp;lt;select id=&amp;quot;timezone&amp;quot; name=&amp;quot;timezone&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$timezone_identifiers = DateTimeZone::listIdentifiers();&lt;br /&gt;
foreach( $timezone_identifiers as $value ){&lt;br /&gt;
if ( preg_match( &#39;/^(America|Antartica|Arctic|Asia|Atlantic|Europe|Indian|Pacific)\//&#39;, $value ) ){&lt;br /&gt;
$ex=explode(&amp;quot;/&amp;quot;,$value);//obtain continent,city &lt;br /&gt;
if ($continent!=$ex[0]){&lt;br /&gt;
if ($continent!=&amp;quot;&amp;quot;) echo &#39;&amp;lt;/optgroup&amp;gt;&#39;;&lt;br /&gt;
echo &#39;&amp;lt;optgroup label=&amp;quot;&#39;.$ex[0].&#39;&amp;quot;&amp;gt;&#39;;&lt;br /&gt;
}&lt;br /&gt;
$city=$ex[1];&lt;br /&gt;
$continent=$ex[0];&lt;br /&gt;
echo &#39;&amp;lt;option value=&amp;quot;&#39;.$value.&#39;&amp;quot;&amp;gt;&#39;.$city.&#39;&amp;lt;/option&amp;gt;&#39;; &lt;br /&gt;
$selected = &#39;&#39;;&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/optgroup&amp;gt;&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
The above code will display the timezones in a select box. The user can select the corresponding timezone. It displays the timezones in the basis of continent. Each continental city is listed as groups. &lt;br /&gt;
&lt;br /&gt;
Step 2: Submit the data and set the timezone&lt;br /&gt;
&lt;br /&gt;
use &amp;lt;form&amp;gt; to submit the selected timezone and set the selected timezone as default timezone. use &#39;date_default_timezone_set&#39; to set the timezone and get the time using time(). Now it will return the time of the new timezone.&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&amp;lt;?php&lt;br /&gt;
date_default_timezone_set(&amp;quot;$timezone&amp;quot;); // set the selected time zone&lt;br /&gt;
echo &amp;quot;&amp;lt;pre&amp;gt;&amp;quot;;&lt;br /&gt;
print_r( getdate() );&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;/div&gt;Now it will print the current date and time of the selected timezone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Full Source Code &lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&amp;lt;?php &lt;br /&gt;
extract($_POST); &lt;br /&gt;
date_default_timezone_set(&amp;quot;$timezone&amp;quot;); &lt;br /&gt;
echo &amp;quot;Time details&amp;quot;;&lt;br /&gt;
echo &amp;quot;&amp;lt;pre&amp;gt;&amp;quot;;&lt;br /&gt;
print_r( getdate() );&lt;br /&gt;
echo &amp;quot;&amp;lt;pre&amp;gt;&amp;quot;;&lt;br /&gt;
echo &amp;quot;Current Time : &amp;quot;;&lt;br /&gt;
echo date(&amp;quot;H:i:s&amp;quot;); &lt;br /&gt;
echo &amp;quot;&amp;lt;br&amp;gt;&amp;quot;;&lt;br /&gt;
echo &amp;quot;Current Time Zone name : &amp;quot;;&lt;br /&gt;
echo $timezone;&lt;br /&gt;
?&amp;gt; &lt;br /&gt;
&amp;lt;form  method=&amp;quot;post&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;select id=&amp;quot;timezone&amp;quot; name=&amp;quot;timezone&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$timezone_identifiers = DateTimeZone::listIdentifiers();&lt;br /&gt;
foreach( $timezone_identifiers as $value ){&lt;br /&gt;
if ( preg_match( &#39;/^(America|Antartica|Arctic|Asia|Atlantic|Europe|Indian|Pacific)\//&#39;, $value ) ){&lt;br /&gt;
$ex=explode(&amp;quot;/&amp;quot;,$value);//obtain continent,city &lt;br /&gt;
if ($continent!=$ex[0]){&lt;br /&gt;
if ($continent!=&amp;quot;&amp;quot;) echo &#39;&amp;lt;/optgroup&amp;gt;&#39;;&lt;br /&gt;
echo &#39;&amp;lt;optgroup label=&amp;quot;&#39;.$ex[0].&#39;&amp;quot;&amp;gt;&#39;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$city=$ex[1];&lt;br /&gt;
$continent=$ex[0];&lt;br /&gt;
if($value == $timezone)&lt;br /&gt;
$selected = &#39;selected&#39;;&lt;br /&gt;
echo &#39;&amp;lt;option &#39;.$selected.&#39; value=&amp;quot;&#39;.$value.&#39;&amp;quot;&amp;gt;&#39;.$city.&#39;&amp;lt;/option&amp;gt;&#39;; &lt;br /&gt;
$selected = &#39;&#39;;&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/optgroup&amp;gt;&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;submit&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;/form&amp;gt; &lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/1385461269911999493/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2011/03/how-to-select-timezone-using-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/1385461269911999493'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/1385461269911999493'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2011/03/how-to-select-timezone-using-php.html' title='How to select the timezone using php'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-6713590173186592214</id><published>2011-03-05T00:38:00.001-08:00</published><updated>2011-11-03T23:53:01.708-07:00</updated><title type='text'>How to execute PHP code in html page</title><content type='html'>When we access a webpage the server decides how to pass the page information to the client. If the page is an html page (.html) the server sends the data direct to the client. But if the page is a server script page ( eg : .php ) the server process the page and send the output to the user.&lt;br /&gt;
&lt;br /&gt;
If we have an html page and we would like to embed some PHP code in that page, usually its not possible by changing the file extension. But using .htaccess file we can make it possible without changing the file extension. Create a .htaccess file and add the following code.&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;AddType application/x-httpd-php .html&lt;br /&gt;
&lt;/div&gt;Upload this file into the root folder.&lt;br /&gt;
&lt;br /&gt;
Now the server processes the .html page as .php file. &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Example html code&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Page name: &lt;strong&gt;sample.html&lt;/strong&gt;&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&amp;lt;html&amp;gt; &lt;br /&gt;
&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;Run PHP from html page&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt; &lt;br /&gt;
&amp;lt;body&amp;gt; &lt;br /&gt;
&amp;lt;?php echo &amp;quot;this is from index.html&amp;quot;; ?&amp;gt; &lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/6713590173186592214/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2011/03/how-to-execute-php-code-in-html-page.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/6713590173186592214'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/6713590173186592214'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2011/03/how-to-execute-php-code-in-html-page.html' title='How to execute PHP code in html page'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-4779085795215386666</id><published>2011-02-21T02:57:00.000-08:00</published><updated>2011-02-22T00:42:06.813-08:00</updated><title type='text'>Create a contact form in Facebook page using php,Ajax and FBML</title><content type='html'>A Facebook page is a public profile page about our business to share with Facebook users. Any Facebook user can create fan pages, if he has a number of 25 fans. Mainly the Facebook profile page is description about our self or our product. If we add a contact form in these page users can easily contact us. The following example shows how to create an AJAX based contact form in the Facebook page.&lt;br /&gt;
&lt;br /&gt;
To create a page, go to applications and add FBML application. This application will add a box in our webpage and here we can add HTML or FBML (Facebook Markup Language) for enhanced Page customization. &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step 1 :Create a Contact form in page&lt;/strong&gt;&lt;br /&gt;
Create a contact form in the page to get the data’s from the user. We can use our simple html to create the form.&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&lt;br /&gt;
&amp;lt;form method=&amp;quot;post&amp;quot; action=&amp;quot;http://www.domain-name.com/contact-facebook.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;label for=&amp;quot;name&amp;quot;&amp;gt;Name:&amp;lt;/label&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;text&amp;quot; name=&amp;quot;name&amp;quot; id=&amp;quot;name&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;label for=&amp;quot;email&amp;quot;&amp;gt;Email:&amp;lt;/label&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;text&amp;quot; name=&amp;quot;email&amp;quot; id=&amp;quot;email&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;button&amp;quot; value=&amp;quot;Submit&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&lt;/div&gt;The above is a simple contact form. We are submitting the form data’s using ajax. So to invoke an ajax function, we must call the ajax function in a particular event. We are trying to call the ajax function in the onclick event. So we can change the button code as follows.&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;button&amp;quot;  onclick=&amp;quot;return sendFormData();&amp;quot; value=&amp;quot;Submit&amp;quot;&amp;gt;&lt;br /&gt;
&lt;/div&gt;&lt;strong&gt;Step 2 : Create the ajax function&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Facebook doesn’t allow us to use any JavaScript we like to use. They have created a JavaScript library to access the DOM, ajax, events etc. This is known as &lt;a href=&quot;http://developers.facebook.com/docs/fbjsnew/&quot; target=&quot;_blank&quot;&gt;FBJS&lt;/a&gt;. We are using these functions to work with the forms. Our ajax function is as follows.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&amp;lt;!--&lt;br /&gt;
function sendFormData() &lt;br /&gt;
{ &lt;br /&gt;
// creating a new FBJS AJAX object&lt;br /&gt;
var ajax = new Ajax(); &lt;br /&gt;
ajax.responseType = Ajax.FBML;&lt;br /&gt;
&lt;br /&gt;
// creating a handle to get response from the server&lt;br /&gt;
ajax.ondone = function(data) &lt;br /&gt;
{ &lt;br /&gt;
document.getElementById(&#39;name&#39;).setValue(&#39;&#39;);&lt;br /&gt;
document.getElementById(&#39;email&#39;).setValue(&#39;&#39;);&lt;br /&gt;
new Dialog().showMessage(&#39;Confirmation&#39;, data); &lt;br /&gt;
} &lt;br /&gt;
// get the form values&lt;br /&gt;
var fields = { &#39;name&#39; : document.getElementById(&#39;name&#39;).getValue(), &#39;email&#39; : document.getElementById(&#39;email&#39;).getValue() };&lt;br /&gt;
ajax.post(&#39;http://www.domain-name.com/contact-facebook.php&#39;, fields);&lt;br /&gt;
return false;&lt;br /&gt;
}&lt;br /&gt;
//--&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;strong&gt;Working&lt;/strong&gt;&lt;br /&gt;
First the above function creates an Ajax object using FBJS class. After that we create a response type to FBML&lt;br /&gt;
&lt;br /&gt;
Define a call back function to handle the response from the server. After execution of the requested server page this function executes. Here we have removed the textbox contents and create a Facebook alert box to popup the result message from the server. We can use various types of dialog boxes here.&lt;br /&gt;
&lt;br /&gt;
Getting the form elements values and keep these values in an array. We are using FBJS getValue function to get the element values.&lt;br /&gt;
&lt;br /&gt;
Using the ajax.post function we are sending this data to our server file. The server file processes the data’s.&lt;br /&gt;
&lt;br /&gt;
return false is used to prevent the script from page submission.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step 3 : Create the mail sending code&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Create a mail sending code and name it as &#39;contact-facebook.php&#39;. Keep the file in the root folder of our server. Add a main sending code as follows.&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&amp;lt;?php&lt;br /&gt;
extract($_POST);&lt;br /&gt;
// create a mail sending code&lt;br /&gt;
$to      = &#39;sample@sample.com&#39;;&lt;br /&gt;
$subject = &#39; Contact message from Facebook Client&#39;;&lt;br /&gt;
// To send HTML mail, the Content-type header must be set&lt;br /&gt;
$headers  = &#39;MIME-Version: 1.0&#39; . &amp;quot;\r\n&amp;quot;;&lt;br /&gt;
$headers .= &#39;Content-type: text/html; charset=iso-8859-1&#39; . &amp;quot;\r\n&amp;quot;;&lt;br /&gt;
$headers .= &#39;From: &#39;.$name.&#39; &amp;lt;&#39;.$email.&#39;&amp;gt;&#39; . &amp;quot;\r\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
$message = &#39;&amp;lt;table width=&amp;quot;458&amp;quot; border=&amp;quot;0&amp;quot;&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td width=&amp;quot;120&amp;quot;&amp;gt;Name : &amp;lt;/td&amp;gt;&amp;lt;td width=&amp;quot;328&amp;quot;&amp;gt;&#39;.$name.&#39;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Email : &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&#39;.$Email.&#39;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&#39;;&lt;br /&gt;
&lt;br /&gt;
if (mail($to, $subject, $message, $headers))&lt;br /&gt;
$answer = &amp;quot;Thank you for contacting us&amp;quot;;&lt;br /&gt;
else&lt;br /&gt;
$answer = &amp;quot;Error.. Cannot send the mail&amp;quot;;&lt;br /&gt;
// mail sending code ends&lt;br /&gt;
echo $answer;&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
The above code sends the mail to the mail id we specify. Also will populate the result message in the Facebook page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;   FBML Source Code&lt;br /&gt;
&lt;/strong&gt;    &lt;div class=&quot;codedisplay&quot;&gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&amp;lt;!--&lt;br /&gt;
function sendFormData() &lt;br /&gt;
{ &lt;br /&gt;
// creating a new FBJS AJAX object&lt;br /&gt;
var ajax = new Ajax(); &lt;br /&gt;
ajax.responseType = Ajax.FBML;&lt;br /&gt;
&lt;br /&gt;
// creating a handle to get response from the server&lt;br /&gt;
ajax.ondone = function(data) &lt;br /&gt;
{ &lt;br /&gt;
document.getElementById(&#39;name&#39;).setValue(&#39;&#39;);&lt;br /&gt;
document.getElementById(&#39;email&#39;).setValue(&#39;&#39;);&lt;br /&gt;
new Dialog().showMessage(&#39;Confirmation&#39;, data); &lt;br /&gt;
} &lt;br /&gt;
// get the form values&lt;br /&gt;
var fields = { &#39;name&#39; : document.getElementById(&#39;name&#39;).getValue(), &#39;email&#39; : document.getElementById(&#39;email&#39;).getValue() };&lt;br /&gt;
ajax.post(&#39;http://www.domain-name.com/contact-facebook.php&#39;, fields);&lt;br /&gt;
return false;&lt;br /&gt;
}&lt;br /&gt;
//--&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;form method=&amp;quot;post&amp;quot; action=&amp;quot;http://www.domain-name.com/contact-facebook.php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;label for=&amp;quot;name&amp;quot;&amp;gt;Name:&amp;lt;/label&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;text&amp;quot; name=&amp;quot;name&amp;quot; id=&amp;quot;name&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;label for=&amp;quot;email&amp;quot;&amp;gt;Email:&amp;lt;/label&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;text&amp;quot; name=&amp;quot;email&amp;quot; id=&amp;quot;email&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;button&amp;quot;  onclick=&amp;quot;return sendFormData();&amp;quot; value=&amp;quot;Submit&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;p id=&amp;quot;ajaxMessage&amp;quot;&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/4779085795215386666/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2011/02/create-contact-form-in-facebook-page.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/4779085795215386666'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/4779085795215386666'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2011/02/create-contact-form-in-facebook-page.html' title='Create a contact form in Facebook page using php,Ajax and FBML'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-3158745662729881890</id><published>2011-02-04T21:47:00.000-08:00</published><updated>2011-02-04T21:47:03.745-08:00</updated><title type='text'>how to disable mouse over of a youtube video ?</title><content type='html'>If we are embedding youtube videos in our webpage, usually we can play/pause the videos. Even we will redirect to youtube video page. Normally we can’t change the properties of play/pause functionality on mouse over. But we can disable the area of the video by using css .&lt;br /&gt;
&lt;br /&gt;
First embed the youtube video in our page. &lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&amp;lt;embed src=&amp;quot;http://www.youtube.com/v/R55e-uHQna0&amp;amp;autoplay=1&amp;quot; type=&amp;quot;application/x-shockwave-flash&amp;quot; wmode=&amp;quot;transparent&amp;quot; width=&amp;quot;425&amp;quot; height=&amp;quot;350&amp;quot;&amp;gt;&amp;lt;/embed&amp;gt;&lt;br /&gt;
&lt;/div&gt;After that create a div with absolute position similar as the height and width of the video. &lt;br /&gt;
Set a transparent background for that div. &lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;&lt;br /&gt;
  #apDiv1 {&lt;br /&gt;
  position:absolute;&lt;br /&gt;
  width:425px;&lt;br /&gt;
  height:350px;&lt;br /&gt;
  background:url(transparent.png);}&lt;br /&gt;
  &amp;lt;/style&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;apDiv1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
So no event will work on the flash video file. This will be applicable for all flash videos.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Source Code&lt;/strong&gt;&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
  &amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html; charset=utf-8&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;title&amp;gt;Disable mouse over of a youtube video&amp;lt;/title&amp;gt;&lt;br /&gt;
  &amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;&lt;br /&gt;
  #apDiv1 {&lt;br /&gt;
  position:absolute;&lt;br /&gt;
  width:425px;&lt;br /&gt;
  height:350px;&lt;br /&gt;
  background:url(transparent.png);}&lt;br /&gt;
  &amp;lt;/style&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
  &amp;lt;div id=&amp;quot;apDiv1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;embed src=&amp;quot;http://www.youtube.com/v/R55e-uHQna0&amp;amp;autoplay=1&amp;quot; type=&amp;quot;application/x-shockwave-flash&amp;quot; wmode=&amp;quot;transparent&amp;quot; width=&amp;quot;425&amp;quot; height=&amp;quot;350&amp;quot;&amp;gt;&amp;lt;/embed&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
  &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/3158745662729881890/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2011/02/how-to-disable-mouse-over-of-youtube.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/3158745662729881890'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/3158745662729881890'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2011/02/how-to-disable-mouse-over-of-youtube.html' title='how to disable mouse over of a youtube video ?'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-8457837877230404912</id><published>2011-02-03T04:00:00.000-08:00</published><updated>2011-02-03T04:00:22.279-08:00</updated><title type='text'>Hidden form field to prevent spam</title><content type='html'>Most of the website has a contact form to send emails to webmasters. And most of these forms are targeted by spam bots. They automatically fill the data’s in the form elements and submit these data’s and as a result our mail box will full of spam emails.&lt;br /&gt;
&lt;br /&gt;
In order to avoid this spam emails we can use Captcha . A Captcha is an image that contains a verification code. It may be a text or a number, or a combination of both&lt;br /&gt;
The user must enter the verification code to prove that the entry is not a spam. We are checking the verification code in the server side. But now a day’s spam bots have the ability of character recognition and probably they can break the Captcha. So we need to increase the complexity of Captcha verification code. But it will very difficult for users to read the verification code.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Hidden Form Field&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
This is one simple way to prevent the spam data’s. This is also knows as Invisible Captcha. Just add an extra hidden field in the form. Using css hide the visibility of the text box.  Noramlly humans can&#39;t see the hidden form elements and they wont fill the datas. So the this field remains empty.But spam bots are fill all form elements. So in the server side we can check the hidden filed value , and can check whether it’s a spam or not.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Example :&lt;/strong&gt;&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;  &lt;br /&gt;
    &amp;lt;label for=&amp;quot;email&amp;quot;&amp;gt;Email:&amp;lt;/label&amp;gt;&amp;lt;input type=&amp;quot;text&amp;quot; name=&amp;quot;txtemail&amp;quot; value=&amp;quot;&amp;quot; /&amp;gt; &lt;br /&gt;
    &amp;lt;input class=&amp;quot;confirmation-field&amp;quot; type=&amp;quot;text&amp;quot; name=&amp;quot;txtCaptcha&amp;quot; value=&amp;quot;&amp;quot; /&amp;gt; &lt;br /&gt;
  &amp;lt;style&amp;gt; &lt;br /&gt;
    .confirmation-field { display: none; } &lt;br /&gt;
    &amp;lt;/style&amp;gt; &lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/8457837877230404912/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2011/02/hidden-form-field-to-prevent-spam.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/8457837877230404912'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/8457837877230404912'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2011/02/hidden-form-field-to-prevent-spam.html' title='Hidden form field to prevent spam'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-4038038956284694024</id><published>2011-01-17T00:44:00.000-08:00</published><updated>2011-01-17T00:44:21.639-08:00</updated><title type='text'>How to embed YouTube Videos as Valid XHTML 1.0 ?</title><content type='html'>Youtube embed code help us to embed the youtube videos in our webapge. The youtube embed code is similar as follows.&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&amp;lt;object width=&amp;quot;640&amp;quot; height=&amp;quot;385&amp;quot;&amp;gt;&amp;lt;param name=&amp;quot;movie&amp;quot; value=&amp;quot;http://www.youtube.com/v/me0zQaMqhPY?fs=1&amp;amp;amp;hl=en_US&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;&amp;lt;param name=&amp;quot;allowFullScreen&amp;quot; value=&amp;quot;true&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;&amp;lt;param name=&amp;quot;allowscriptaccess&amp;quot; value=&amp;quot;always&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;&amp;lt;embed src=&amp;quot;http://www.youtube.com/v/me0zQaMqhPY?fs=1&amp;amp;amp;hl=en_US&amp;quot; type=&amp;quot;application/x-shockwave-flash&amp;quot; allowscriptaccess=&amp;quot;always&amp;quot; allowfullscreen=&amp;quot;true&amp;quot; width=&amp;quot;640&amp;quot; height=&amp;quot;385&amp;quot;&amp;gt;&amp;lt;/embed&amp;gt;&amp;lt;/object&amp;gt;&lt;br /&gt;
&lt;/div&gt;If we embed the youtube embed code in our html page, normally we fails in the w3c validation. If we validate this page we can see that the error is because of the&lt;strong&gt; &amp;lt;embed&amp;gt;&lt;/strong&gt; tag. The &lt;a href=&quot;http://webdesign.about.com/od/htmltags/p/bltags_embed.htm&quot; target=&quot;_blank&quot;&gt;&amp;lt;embed&amp;gt;&lt;/a&gt; tag inserts a non-standard object or external content (typically non-HTML) into the document.&lt;br /&gt;
&lt;br /&gt;
To remove the errors from the webapge we can remove the &lt;strong&gt;&amp;lt;embed&amp;gt;&lt;/strong&gt; tag. The code is similar as follows.&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&amp;lt;object type=&amp;quot;application/x-shockwave-flash&amp;quot; width=&amp;quot;640&amp;quot; height=&amp;quot;385&amp;quot; data=&amp;quot;http://www.youtube.com/v/me0zQaMqhPY&amp;quot;&amp;gt;&amp;lt;param name=&amp;quot;movie&amp;quot; value=&amp;quot;http://www.youtube.com/v/me0zQaMqhPY&amp;quot;&amp;gt;&amp;lt;/object&amp;gt;  &lt;br /&gt;
This will remove the w3 error message.&lt;br /&gt;
&lt;/div&gt;We can add the wmode by adding the following code&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&amp;lt;param name=&amp;quot;wmode&amp;quot; value=&amp;quot;transparent&amp;quot;&amp;gt; &lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
You can set the autoplay feature by adding the autoplay parameter in the url.&lt;br /&gt;
&lt;strong&gt;&amp;autoplay=1&lt;/strong&gt;&lt;br /&gt;
like as follows&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt; data=&amp;quot;http://www.youtube.com/v/me0zQaMqhPY&amp;amp;autoplay=1&amp;quot; &lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/4038038956284694024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2011/01/how-to-embed-youtube-videos-as-valid.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/4038038956284694024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/4038038956284694024'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2011/01/how-to-embed-youtube-videos-as-valid.html' title='How to embed YouTube Videos as Valid XHTML 1.0 ?'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-984802905586871524</id><published>2011-01-11T03:24:00.000-08:00</published><updated>2011-01-11T03:24:40.534-08:00</updated><title type='text'>Pagination in wordpress</title><content type='html'>If we have a large number of posts in wordpress , its not good to list all posts in a single page. So we need to restrict the listing of the posts. The query_posts() returns posts from the database . The main disadvantages of query_posts() is the lack of pagination .We can use parameters to change the listing of posts. Suppose we have a number of 50 posts in our site, it’s  better to use pagination in the site. Here am trying to explain about how to use pagination in wordpress with query_posts().&lt;br /&gt;
&lt;br /&gt;
First we need to install a plugin for pagination. We can use WP-Paginate plugin for pagination. We can download the plugin from the following link &lt;a href=&quot;http://wordpress.org/extend/plugins/wp-paginate/&quot; target=&quot;_blank&quot;&gt;http://wordpress.org/extend/plugins/wp-paginate/&lt;/a&gt; and install the plugin.&lt;br /&gt;
&lt;br /&gt;
Add the following code in the page where you want to set pagination links.&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;navigation_nav&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php if(function_exists(&#39;wp_paginate&#39;)) {&lt;br /&gt;
wp_paginate();&lt;br /&gt;
} ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
The above code will generate pagination navigation in the post page.&lt;br /&gt;
&lt;br /&gt;
Next is to set the parameters for the query_posts(). We need to get the current page number and the pagination page number.&lt;br /&gt;
&lt;br /&gt;
Add the following code before query_posts() to get the page number.&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;$paged = (get_query_var(&#39;paged&#39;)) ? get_query_var(&#39;paged&#39;) : 1; &lt;br /&gt;
&lt;/div&gt;The above code get the page number from the GET variables. If the variable is not set , the page number is set to 1;&lt;br /&gt;
&lt;br /&gt;
Next we need to pass the parameters to query_posts(). Use the following code to pass the parameters to query_posts().&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;query_posts(&amp;quot;&amp;amp;paged=&amp;quot;.$paged)&lt;br /&gt;
&lt;/div&gt;This will display a pagination link in the post page. We can set the number of posts to display by setting the &#39;posts_per_page&#39; variable.&lt;br /&gt;
Similar as follows&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;query_posts(&amp;quot;&amp;amp;paged=&amp;quot;.$paged.&amp;quot;&amp;amp;posts_per_page=10&amp;quot;)&lt;br /&gt;
&lt;/div&gt;Also we can set the property in the admin side.&lt;br /&gt;
&lt;br /&gt;
To set the post per page using admin panel&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;Go to Settings -&gt; Select Reading -&gt; edit &#39;Blog pages show at most&#39; to your number.&lt;br /&gt;
&lt;/div&gt;But priority for post per page will be with the code that we added in the page.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Full source code:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
After applying the codes the page will be similar as follows.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&lt;br /&gt;
 &amp;lt;?php&lt;br /&gt;
 // get the page number and get the posts&lt;br /&gt;
  $paged = (get_query_var(&#39;paged&#39;)) ? get_query_var(&#39;paged&#39;) : 1; &lt;br /&gt;
  $q = &amp;quot;paged=&amp;quot;.$paged.&#39;&amp;amp;posts_per_page=2&#39;;&lt;br /&gt;
  query_posts($q);&lt;br /&gt;
  ?&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;div class=&amp;quot;navigation_nav&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;?php &lt;br /&gt;
  // pagination links&lt;br /&gt;
  if(function_exists(&#39;wp_paginate&#39;)) {&lt;br /&gt;
  wp_paginate();&lt;br /&gt;
  } ?&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;
  &lt;br /&gt;
 &amp;lt;?php&lt;br /&gt;
 // listing of posts&lt;br /&gt;
 if (have_posts()) : &lt;br /&gt;
  while (have_posts()) : the_post();&lt;br /&gt;
 $custom_fields = get_post_custom(get_the_ID()); &lt;br /&gt;
 ?&amp;gt; &lt;br /&gt;
 &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/984802905586871524/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2011/01/pagination-in-wordpress.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/984802905586871524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/984802905586871524'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2011/01/pagination-in-wordpress.html' title='Pagination in wordpress'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-1643769910527205209</id><published>2011-01-04T01:38:00.001-08:00</published><updated>2011-01-04T01:38:33.372-08:00</updated><title type='text'>Static DIV in a webpage</title><content type='html'>For an html object, there are five position properties: static, relative, absolute, fixed and inherit.&lt;br /&gt;
We can use fixed property to set a DIV fixed in a webpage and stays in the same place while scrolling.&lt;br /&gt;
The IE6 does not support position: fixed and shows it in the position following this text where it has been coded and it will scroll. &lt;br /&gt;
&lt;br /&gt;
A position: fixed div needs to be positioned with regard to the intended viewport size. A div with position: fixed; top: 700px will never show on a screen resolution of 800 x 600 and scrolling will not make it appear.&lt;br /&gt;
&lt;br /&gt;
The code is&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&amp;lt;div id=&amp;quot;static1&amp;quot;&amp;gt;static DIV&amp;lt;/div&amp;gt; &lt;br /&gt;
&lt;/div&gt;The styles are:-&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;#static1 { position: fixed; top: 95px; left: 30px; width: 220px; height: 40px; background-color:#00CCFF; }  &lt;br /&gt;
&lt;/div&gt;Full Code :&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&amp;gt; &lt;br /&gt;
  &amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&amp;gt; &lt;br /&gt;
  &amp;lt;head&amp;gt; &lt;br /&gt;
  &amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html; charset=utf-8&amp;quot; /&amp;gt; &lt;br /&gt;
  &amp;lt;title&amp;gt;Static DIV&amp;lt;/title&amp;gt; &lt;br /&gt;
  &amp;lt;style&amp;gt; &lt;br /&gt;
  #static1 { &lt;br /&gt;
  background-color:#00CCFF; &lt;br /&gt;
  height:40px; &lt;br /&gt;
  right:5px; &lt;br /&gt;
  position:fixed; &lt;br /&gt;
  bottom:5px; &lt;br /&gt;
  width:220px; &lt;br /&gt;
  } &lt;br /&gt;
  &amp;lt;/style&amp;gt; &lt;br /&gt;
  &amp;lt;/head&amp;gt; &lt;br /&gt;
 &amp;lt;body&amp;gt; &lt;br /&gt;
  &amp;lt;div id=&amp;quot;static1&amp;quot;&amp;gt;Static DIV&amp;lt;/div&amp;gt; &lt;br /&gt;
 &amp;lt;div style=&amp;quot;height:1000px;&amp;quot;&amp;gt; &lt;br /&gt;
  page contents &lt;br /&gt;
  &amp;lt;/div&amp;gt; &lt;br /&gt;
 &amp;lt;/body&amp;gt; &lt;br /&gt;
  &amp;lt;/html&amp;gt; &lt;br /&gt;
 &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/1643769910527205209/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2011/01/static-div-in-webpage.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/1643769910527205209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/1643769910527205209'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2011/01/static-div-in-webpage.html' title='Static DIV in a webpage'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-6452098793724171723</id><published>2010-12-19T01:49:00.000-08:00</published><updated>2011-02-27T22:31:31.395-08:00</updated><title type='text'>session using php - sample code</title><content type='html'>A session is similar as a variable that resides in the server. The sesion variable is a global variable that can be used in all pages in a website. We can hold the userids, user email , privilages etc in the session. &lt;br /&gt;
&lt;br /&gt;
The following is a sample code for session hanling. We can use an object oriented programming to handle the session.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step 1 :&lt;/strong&gt;&lt;br /&gt;
The SessionManager class is the session handler file. It contains the functions to create session, to store content to session, view the session content, delete session etc.&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&lt;br /&gt;
&amp;lt;?php &lt;br /&gt;
class SessionManager&lt;br /&gt;
{&lt;br /&gt;
public function __construct()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public function getSession($name = &#39;admin&#39;)&lt;br /&gt;
{&lt;br /&gt;
return $this-&amp;gt;hasSession() ? ($_SESSION[$name]) : null;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public function hasSession($name = &#39;admin&#39;)&lt;br /&gt;
{&lt;br /&gt;
return (isset($_SESSION[$name]));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public function createSession($content,$name = &#39;admin&#39;, $override = false)&lt;br /&gt;
{&lt;br /&gt;
if(!$this-&amp;gt;hasSession() || ($this-&amp;gt;hasSession() &amp;amp;&amp;amp; $override) )&lt;br /&gt;
{&lt;br /&gt;
$_SESSION[$name]           = $content;&lt;br /&gt;
session_write_close();&lt;br /&gt;
return true;&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
return false;&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public function destroySession ($name = &#39;admin&#39;)&lt;br /&gt;
{&lt;br /&gt;
$_SESSION[$name] = null;&lt;br /&gt;
unset($_SESSION[$name]);&lt;br /&gt;
&lt;br /&gt;
return true;&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;/div&gt;The createSession function creates the session . If we pass the session name it will create a session with the passing name, otherwise it will create session with tha name as &#39;admin&#39;.&lt;br /&gt;
The &#39;hasSession&#39; function checks whether the session is existing or not. It will return true, if the session exists.The &#39;getSession&#39; function returns the informations stored in the session.&lt;br /&gt;
&lt;br /&gt;
The &#39;destroySession&#39; function destroys the session details.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step 2:&lt;/strong&gt;&lt;br /&gt;
Create an object for the SessionManager. Here we are using conditions to display how these functions are working.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
session_start();&lt;br /&gt;
include_once &#39;SessionManager.class.php&#39;;&lt;br /&gt;
$sess = new SessionManager();&lt;br /&gt;
extract($_GET);&lt;br /&gt;
if($type==1)&lt;br /&gt;
{&lt;br /&gt;
$advalue = array(&#39;adid&#39;=&amp;gt;1,&#39;adname&#39;=&amp;gt;&#39;main admin&#39;,&#39;privilage&#39;=&amp;gt;&#39;super&#39;,&#39;lastlogin&#39;=&amp;gt; time());&lt;br /&gt;
$sess-&amp;gt;createSession($advalue);&lt;br /&gt;
}&lt;br /&gt;
else if($type==2)&lt;br /&gt;
{&lt;br /&gt;
echo &amp;quot;&amp;lt;pre&amp;gt;&amp;quot;;&lt;br /&gt;
print_r($sess-&amp;gt;getSession());&lt;br /&gt;
echo &amp;quot;&amp;lt;/pre&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else if($type==3)&lt;br /&gt;
{&lt;br /&gt;
$sess-&amp;gt;destroySession();&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;?type=1&amp;quot;&amp;gt; Create Session &amp;lt;/a&amp;gt;  &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;?type=2&amp;quot;&amp;gt;View Session&amp;lt;/a&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;?type=3&amp;quot;&amp;gt; Delete Session &amp;lt;/a&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Here we are storing an array in the session.</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/6452098793724171723/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2010/07/session-using-php-sample-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/6452098793724171723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/6452098793724171723'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2010/07/session-using-php-sample-code.html' title='session using php - sample code'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-7164833841287526880</id><published>2010-11-24T04:12:00.000-08:00</published><updated>2010-11-24T20:32:56.334-08:00</updated><title type='text'>Creating an RSS feed with PHP and MySQL</title><content type='html'>What is RSS feed ?&lt;br /&gt;
&lt;br /&gt;
RSS (most commonly expanded as Really Simple Syndication) is a family of web feed formats used to publish frequently updated works—such as blog entries, news headlines, audio, and video—in a standardized format. An RSS document (which is called a &quot;feed&quot;, &quot;web feed&quot;, or &quot;channel&quot;) includes full or summarized text, plus metadata such as publishing dates and authorship. Web feeds benefit publishers by letting them syndicate content automatically. They benefit readers who want to subscribe to timely updates from favored websites or to aggregate feeds from many sites into one place. RSS feeds can be read using software called an &quot;RSS reader&quot;, &quot;feed reader&quot;, or &quot;aggregator&quot;, which can be web-based, desktop-based, or mobile-device-based.&lt;br /&gt;
http://en.wikipedia.org/wiki/RSS_feed&lt;br /&gt;
&lt;br /&gt;
RSS is a technology that is being used by millions of web users around the world to keep track of their favorite websites. &lt;br /&gt;
Using RSS feed we can share our website content with the rest of the Internet. &lt;br /&gt;
&lt;br /&gt;
The RSS format is based on XML that is built using standardised tags. Following is an example of RSS document.&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&amp;lt;rss version=&amp;quot;2.0&amp;quot;&amp;gt; &lt;br /&gt;
&amp;lt;channel&amp;gt; &lt;br /&gt;
&amp;lt;title&amp;gt;RSS Feed&amp;lt;/title&amp;gt; &lt;br /&gt;
&amp;lt;description&amp;gt;RSS Feed&amp;lt;/description&amp;gt; &lt;br /&gt;
&amp;lt;link&amp;gt;http://mywebsite.com&amp;lt;/link&amp;gt; &lt;br /&gt;
&amp;lt;lastBuildDate&amp;gt;Wed, 24 Nov 2010 09:47:31 +0100&amp;lt;/lastBuildDate&amp;gt; &lt;br /&gt;
&amp;lt;language&amp;gt;en-us&amp;lt;/language&amp;gt; &lt;br /&gt;
&amp;lt;copyright&amp;gt;Copyright (C) 2010 mywebsite.com&amp;lt;/copyright&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;item&amp;gt; &lt;br /&gt;
&amp;lt;title&amp;gt;Sample title one&amp;lt;/title&amp;gt; &lt;br /&gt;
&amp;lt;link&amp;gt;http://mywebsite.com/news1.html&amp;lt;/link&amp;gt; &lt;br /&gt;
&amp;lt;description&amp;gt;This is the description of the smaple title one&amp;lt;/description&amp;gt; &lt;br /&gt;
&amp;lt;pubDate&amp;gt;Wed, 10 Nov 2010 11:04:12 +0100&amp;lt;/pubDate&amp;gt; &lt;br /&gt;
&amp;lt;/item&amp;gt; &lt;br /&gt;
&amp;lt;item&amp;gt; &lt;br /&gt;
&amp;lt;title&amp;gt;Sample title two&amp;lt;/title&amp;gt; &lt;br /&gt;
&amp;lt;link&amp;gt;http://mywebsite.com/news2.html&amp;lt;/link&amp;gt; &lt;br /&gt;
&amp;lt;description&amp;gt;This is the description of the smaple title two&amp;lt;/description&amp;gt; &lt;br /&gt;
&amp;lt;pubDate&amp;gt;Wed, 10 Nov 2010 11:03:24 +0100&amp;lt;/pubDate&amp;gt; &lt;br /&gt;
&amp;lt;/item&amp;gt; &lt;br /&gt;
&amp;lt;item&amp;gt; &lt;br /&gt;
&amp;lt;title&amp;gt;Sample title three&amp;lt;/title&amp;gt; &lt;br /&gt;
&amp;lt;link&amp;gt;http://mywebsite.com/news3.html&amp;lt;/link&amp;gt; &lt;br /&gt;
&amp;lt;description&amp;gt;This is the description of the smaple title three&amp;lt;/description&amp;gt; &lt;br /&gt;
&amp;lt;pubDate&amp;gt;Wed, 10 Nov 2010 11:01:53 +0100&amp;lt;/pubDate&amp;gt; &lt;br /&gt;
&amp;lt;/item&amp;gt; &lt;br /&gt;
&amp;lt;/channel&amp;gt; &lt;br /&gt;
&amp;lt;/rss&amp;gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
We can generate an RSS feed similar as the above sample using PHP and MySQL.&lt;br /&gt;
&lt;br /&gt;
In this example we are listing the latest articles from the database are feed. For that we need a database table . If not not created, we can create a table using the following code..&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;CREATE TABLE `articles` (&lt;br /&gt;
`id` int(11) unsigned NOT NULL auto_increment,&lt;br /&gt;
`title` varchar(255) NOT NULL default &#39;&#39;,&lt;br /&gt;
`link` varchar(255) NOT NULL default &#39;&#39;,&lt;br /&gt;
`introtext` mediumtext NOT NULL,&lt;br /&gt;
`created` datetime NOT NULL default &#39;0000-00-00 00:00:00&#39;,&lt;br /&gt;
PRIMARY KEY  (`id`)&lt;br /&gt;
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;&lt;/div&gt;&lt;br /&gt;
RSS feeds are using XML tags. So we are going to generate the XML tags using PHP.&lt;br /&gt;
&lt;br /&gt;
Step 1 : Creating the header&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;header(&amp;quot;Content-Type: application/rss+xml; charset=ISO-8859-1&amp;quot;);&lt;/div&gt;&lt;br /&gt;
The first step is that , we need to tell PHP that what type of data we would like to output. In the header function we are specify that the content type is  &quot; application/rss+xml &quot;. This will output a XML formated data into the browser.&lt;br /&gt;
&lt;br /&gt;
Step 2 : Setup a Database connecction&lt;br /&gt;
&lt;br /&gt;
Create a database connection to fetch the datas from the database.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;DEFINE (&#39;DB_USER&#39;, &#39;dbusername&#39;); &lt;br /&gt;
DEFINE (&#39;DB_PASSWORD&#39;, &#39;dbpassword&#39;); &lt;br /&gt;
DEFINE (&#39;DB_HOST&#39;, &#39;dbroot&#39;); &lt;br /&gt;
DEFINE (&#39;DB_NAME&#39;, &#39;dbname&#39;); &lt;br /&gt;
&lt;br /&gt;
$connection = @mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die(&#39;Could not connect to database&#39;); &lt;br /&gt;
mysql_select_db(DB_NAME) or die (&#39;Error.. Could not connecct to database&#39;); &lt;br /&gt;
$query = &amp;quot;SELECT * FROM articles ORDER BY id DESC&amp;quot;; &lt;br /&gt;
$result = mysql_query($query) or die (&amp;quot;Error.. Could not execute query&amp;quot;); &lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
Step 3 : Add RSS Feed Information &lt;br /&gt;
&lt;br /&gt;
Next add the information about our RSS feed such as the title of it, the description, and a link to the the site.&lt;br /&gt;
Also add the xml version, rss version etc.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;$rssfeed = &#39;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;rss version=&amp;quot;2.0&amp;quot;&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;channel&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;title&amp;gt;RSS Feed&amp;lt;/title&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;description&amp;gt;RSS Feed&amp;lt;/description&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;link&amp;gt;http://mywebsite.com&amp;lt;/link&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;lastBuildDate&amp;gt;Wed, 24 Nov 2010 09:47:31 +0100&amp;lt;/lastBuildDate&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;language&amp;gt;en-us&amp;lt;/language&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;copyright&amp;gt;Copyright (C) 2010 mywebsite.com&amp;lt;/copyright&amp;gt;&#39;; &lt;br /&gt;
&lt;/div&gt;Step 4 : Adding RSS Items&lt;br /&gt;
&lt;br /&gt;
Next, we need to extract our data by looping through our MySQL database to create the &amp;lt;item&amp;gt; tags.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;while($row = mysql_fetch_array($result)) &lt;br /&gt;
{ &lt;br /&gt;
extract($row); &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;item&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;title&amp;gt;&#39; . $title . &#39;&amp;lt;/title&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;link&amp;gt;http://mywebsite.com/news&#39;.$id.&#39;.html&amp;lt;/link&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;description&amp;gt;[CDATA[&#39; .$introtext . &#39;]]&amp;lt;/description&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;pubDate&amp;gt;&#39; . $created . &#39;&amp;lt;/pubDate&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;/item&amp;gt;&#39;; &lt;br /&gt;
} &lt;/div&gt;&lt;br /&gt;
Make sure you escape any characters that might cause your XML to invalidate, these characters include &amp;lt;, &amp;gt;, &amp; - I like to enclose any content that may contain HTML inside a CDATA section.&lt;br /&gt;
&lt;br /&gt;
Step 5: Close Channel, RSS tags and output the rssfeed.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;$rssfeed .= &#39;&amp;lt;/channel&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;/rss&amp;gt;&#39;; &lt;br /&gt;
&lt;br /&gt;
echo $rssfeed; &lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Step 6: Validate your feed&lt;br /&gt;
&lt;br /&gt;
Validate your feed using FeedValidator.org.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Full Source Code:&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&amp;lt;?php &lt;br /&gt;
header(&amp;quot;Content-Type: application/rss+xml; charset=ISO-8859-1&amp;quot;); &lt;br /&gt;
DEFINE (&#39;DB_USER&#39;, &#39;root&#39;); &lt;br /&gt;
DEFINE (&#39;DB_PASSWORD&#39;, &#39;&#39;); &lt;br /&gt;
DEFINE (&#39;DB_HOST&#39;, &#39;localhost&#39;); &lt;br /&gt;
DEFINE (&#39;DB_NAME&#39;, &#39;fourjmktg9908_iapc&#39;);  &lt;br /&gt;
$connection = @mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die(&#39;Could not connect to database&#39;); &lt;br /&gt;
mysql_select_db(DB_NAME) or die (&#39;Error.. Could not connecct to database&#39;); &lt;br /&gt;
$query = &amp;quot;SELECT * FROM jos_content ORDER BY id DESC&amp;quot;; &lt;br /&gt;
$result = mysql_query($query) or die (&amp;quot;Error.. Could not execute query&amp;quot;); &lt;br /&gt;
&lt;br /&gt;
$rssfeed = &#39;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;rss version=&amp;quot;2.0&amp;quot;&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;channel&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;title&amp;gt;RSS Feed&amp;lt;/title&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;description&amp;gt;RSS Feed&amp;lt;/description&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;link&amp;gt;http://mywebsite.com&amp;lt;/link&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;lastBuildDate&amp;gt;Wed, 24 Nov 2010 09:47:31 +0100&amp;lt;/lastBuildDate&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;language&amp;gt;en-us&amp;lt;/language&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;copyright&amp;gt;Copyright (C) 2010 mywebsite.com&amp;lt;/copyright&amp;gt;&#39;; &lt;br /&gt;
while($row = mysql_fetch_array($result)) { &lt;br /&gt;
extract($row); &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;item&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;title&amp;gt;&#39; . $title . &#39;&amp;lt;/title&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;link&amp;gt;http://mywebsite.com/news&#39;.$id.&#39;.html&amp;lt;/link&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;description&amp;gt;[CDATA[&#39; .$introtext . &#39;]]&amp;lt;/description&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;pubDate&amp;gt;&#39; . $created . &#39;&amp;lt;/pubDate&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;/item&amp;gt;&#39;; &lt;br /&gt;
} &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;/channel&amp;gt;&#39;; &lt;br /&gt;
$rssfeed .= &#39;&amp;lt;/rss&amp;gt;&#39;; &lt;br /&gt;
echo $rssfeed; &lt;br /&gt;
?&amp;gt; &lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
Save this file as index.php and save it in the folder named &#39;feed&#39;. Now we can directly access the rss feeds from the browser using the link &#39; http://mywebsite.com/feed &#39;</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/7164833841287526880/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2010/11/creating-rss-feed-with-php-and-mysql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/7164833841287526880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/7164833841287526880'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2010/11/creating-rss-feed-with-php-and-mysql.html' title='Creating an RSS feed with PHP and MySQL'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-2888203741915027207</id><published>2010-11-22T01:42:00.000-08:00</published><updated>2010-11-22T01:42:48.969-08:00</updated><title type='text'>How to resize youtube embed video using regular expression ?</title><content type='html'>When we are creating a web application that let the user insert video embeds coming from YouTube or from Vimeo, or what ever else, there is the problem of the embed size. Most probably they will directly insert the embed code, that they are copied from youtube. This size of object tag (iframe, embed, object) may affect our design. If we are creating a video gallery we need to resize the embed code video into our size. In PHP we can use regular expression to resize the embed code.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Sample Code&lt;/b&gt;&lt;br /&gt;
&lt;blockquote&gt;&amp;lt;?php&lt;br /&gt;
 //eg :&lt;br /&gt;
    $video = &quot;&amp;lt;object width=&amp;quot;640&amp;quot; height=&amp;quot;385&amp;quot;&amp;gt;&lt;br&gt;&lt;br /&gt;
  &amp;lt;param value=&amp;quot;http://www.youtube.com/v/bIx5vDn28eE?fs=1&amp;amp;amp;hl=en_US&amp;quot; name=&amp;quot;movie&amp;quot; /&amp;gt;&lt;br&gt;&lt;br /&gt;
  &amp;lt;param value=&amp;quot;true&amp;quot; name=&amp;quot;allowFullScreen&amp;quot; /&amp;gt;&lt;br&gt;&lt;br /&gt;
&amp;lt;param value=&amp;quot;always&amp;quot; name=&amp;quot;allowscriptaccess&amp;quot; /&amp;gt;&amp;lt;embed width=&amp;quot;640&amp;quot; height=&amp;quot;385&amp;quot; allowfullscreen=&amp;quot;true&amp;quot; allowscriptaccess=&amp;quot;always&amp;quot; type=&amp;quot;application/x-shockwave-flash&amp;quot; src=&amp;quot;http://www.youtube.com/v/bIx5vDn28eE?fs=1&amp;amp;amp;hl=en_US&amp;quot;&amp;gt;&amp;lt;/embed&amp;gt;&amp;lt;/object&amp;gt;&quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // our prefered size : width=&quot;208&quot; height=&quot;103&quot; &lt;br /&gt;
    // regular exression to change the height and width&lt;br /&gt;
    $pattern = &quot;/height=\&quot;[0-9]*\&quot;/&quot;;&lt;br /&gt;
    $video = preg_replace($pattern, &quot;height=&#39;103&#39;&quot;, $video);&lt;br /&gt;
    $pattern = &quot;/width=\&quot;[0-9]*\&quot;/&quot;;&lt;br /&gt;
    $video = preg_replace($pattern, &quot;width=&#39;208&#39;&quot;, $video);&lt;br /&gt;
    echo $video;&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;/blockquote&gt;The above code will resize the embed video into the size we are given.&lt;br /&gt;
&lt;br /&gt;
If we want to add the &#39;wmode&#39; in the video we can assign that value along with the width parameter.&lt;br /&gt;
&lt;br /&gt;
eg :&lt;br /&gt;
    &lt;blockquote&gt;$video = preg_replace($pattern, &quot;width=&#39;208&#39; wmode=&#39;transparent&#39;&quot;, $video);&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/2888203741915027207/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2010/11/how-to-resize-youtube-embed-video-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/2888203741915027207'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/2888203741915027207'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2010/11/how-to-resize-youtube-embed-video-using.html' title='How to resize youtube embed video using regular expression ?'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-2270971445007553399</id><published>2010-11-18T03:07:00.000-08:00</published><updated>2010-11-18T03:07:31.477-08:00</updated><title type='text'>How to check a radio button list is checked or not using javascript?</title><content type='html'>How to check a radio button list is checked or not using javascript ?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Radio Buttons are work in groups .If we have a set of radio buttons on a form , they are unchecked by default. We want an alert message if the radio buttons are not checked on submit. &lt;br /&gt;
&lt;br /&gt;
Radio buttons are stored as an array, so we have to loop the array elements to see if one is checked or not.&lt;br /&gt;
&lt;br /&gt;
To determine whether a particular button is pressed the syntax required is:&lt;br /&gt;
    &lt;blockquote&gt;test = document.formName.radioGroupName[indexNumber].checked; &lt;/blockquote&gt;    &lt;br /&gt;
This will result a TRUE or False value . If the radio button is checked it will result a TRUE value, otherwise FALSE.&lt;br /&gt;
&lt;br /&gt;
Sample Code&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&lt;p&gt;&amp;lt;script language=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br&gt;&lt;br /&gt;
  function validate()&lt;br&gt;&lt;br /&gt;
  {&lt;br&gt;&lt;br /&gt;
    var flag = false;&lt;br&gt;&lt;br /&gt;
  for(var i =0 ;i&amp;lt;document.frmgraph.cond1.length; i++)&lt;br&gt;&lt;br /&gt;
  {&lt;br&gt;&lt;br /&gt;
  if(document.frmgraph.cond1[i].checked)&lt;br&gt;&lt;br /&gt;
  flag = true;&lt;br&gt;&lt;br /&gt;
  }&lt;br&gt;&lt;br /&gt;
  if(flag == false)&lt;br&gt;&lt;br /&gt;
  {&lt;br&gt;&lt;br /&gt;
  alert(&amp;quot;Please select the group&amp;quot;);&lt;br&gt;&lt;br /&gt;
  return false;&lt;br&gt;&lt;br /&gt;
  }&lt;br&gt;&lt;br /&gt;
  return true;&lt;br&gt;&lt;br /&gt;
  }&lt;br&gt;&lt;br /&gt;
  &amp;lt;/script&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;lt;form id=&amp;quot;frmgraph&amp;quot; name=&amp;quot;frmgraph&amp;quot; method=&amp;quot;post&amp;quot;  onsubmit=&amp;quot;return validate();&amp;quot;&amp;gt;&lt;br&gt;&lt;br /&gt;
  Male &amp;lt;input type=&amp;quot;radio&amp;quot; name=&amp;quot;cond1&amp;quot; id=&amp;quot;cond1&amp;quot; value=&amp;quot;male&amp;quot; /&amp;gt;&lt;br&gt;&lt;br /&gt;
  Female   &amp;lt;input type=&amp;quot;radio&amp;quot; name=&amp;quot;cond1&amp;quot; id=&amp;quot;cond1&amp;quot; value=&amp;quot;female&amp;quot; /&amp;gt;&lt;br&gt;&lt;br /&gt;
  &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;btnSubmit&amp;quot; id=&amp;quot;btnSubmit&amp;quot; value=&amp;quot;Submit&amp;quot; /&amp;gt;&lt;br&gt;&lt;br /&gt;
  &amp;lt;/form&amp;gt; &lt;/p&gt;&lt;/blockquote&gt;  &lt;br /&gt;
  &lt;br /&gt;
 In this function the javascript will alert a message if the radio button is not checked.</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/2270971445007553399/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2010/11/how-to-check-radio-button-list-is.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/2270971445007553399'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/2270971445007553399'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2010/11/how-to-check-radio-button-list-is.html' title='How to check a radio button list is checked or not using javascript?'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-7020613900499476478</id><published>2010-11-17T23:14:00.000-08:00</published><updated>2010-11-17T23:18:57.021-08:00</updated><title type='text'>New PHP V6 features</title><content type='html'>PHP is already popular, used in millions of domains (according to Netcraft), supported by most ISPs and used by household-name Web companies like Yahoo! The upcoming versions of PHP aim to add to this success by introducing new features that make PHP more usable in some cases and more secure in others. Are you ready for PHP V6? If you were upgrading tomorrow, would your scripts execute just fine or would you have work to do? This article focuses on the changes for PHP V6 — some of them back-ported to versions PHP V5.x — that could require some tweaks to your current scripts.&lt;br /&gt;
&lt;br /&gt;
If you&#39;re not using PHP yet and have been thinking about it, take a look at its latest features. These features, from Unicode to core support for XML, make it even easier for you to write feature-filled PHP applications. &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;New PHP V6 features&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
PHP V6 is currently available as a developer snapshot, so you can download and try out many of the features and changes listed in this article.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Improved Unicode support&lt;/strong&gt;&lt;br /&gt;
Much improved for PHP V6 is support for Unicode strings in many of the core functions. This new feature has a big impact because it will allow PHP to support a broader set of characters for international support. So, if you&#39;re a developer or architect using a different language, such as the Java™ programming language, because it has better internationalization (i18n) support than PHP, it&#39;ll be time to take another look at PHP when the support improves. &lt;br /&gt;
&lt;br /&gt;
Unicode support at present can be set on a per request basis. This equates to PHP having to store both Unicode and non-Unicode variants of class, method and function names in the symbol tables. In short - it uses up more resources. Their decision is to make the Unicode setting server wide, not request wide. Turning Unicode off where not required can help performance and they quote some string functions as being up to 300% slower and whole applications 25% slower as a result. The decision to move it to the php.ini in my mind does take the control away from the user, and puts it into the hands of the Web Host.&lt;br /&gt;
&lt;br /&gt;
If you compile PHP yourself or are responsible for this on your servers then you may be interested to know that PHP 6 will require the ICU libs (regardless if Unicode is turned on or off). The build system will bail out if the required ICU libs cannot be found. In a nutshell, you&#39;ll have another thing to install if you want to compile PHP.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Namespaces&lt;/strong&gt;&lt;br /&gt;
Namespaces are a way of avoiding name collisions between functions and classes without using prefixes in naming conventions that make the names of your methods and classes unreadable. So by using namespaces, you can have class names that someone else might use, but now you don&#39;t have to worry about running into any problems. Listing 1 provides an example of a namespace in PHP.&lt;br /&gt;
You won&#39;t have to update or change anything in your code because any PHP code you write that doesn&#39;t include namespaces will run just fine. Because the namespaces feature appears to be back-ported to V5.3 of PHP, when it becomes available, you can start to introduce namespaces into your own PHP applications. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Listing 1. Example of a namespace&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&amp;lt;?php&lt;br /&gt;
// I&#39;m not sure why I would implement my own XMLWriter, but at least&lt;br /&gt;
// the name of this one won&#39;t collide with the one built in to PHP&lt;br /&gt;
namespace NathanAGood;&lt;br /&gt;
class XMLWriter &lt;br /&gt;
{&lt;br /&gt;
    // Implementation here...&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$writer = new NathanAGood::XMLWriter();&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;strong&gt;Web 2.0 features&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Depending on how you use PHP and what your scripts look like now, the language and syntax differences in PHP V6 may or may not affect you as much as the next features, which are those that directly allow you to introduce Web 2.0 features into your PHP application.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;SOAP&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
SOAP is one of the protocols that Web services &quot;speak&quot; and is supported in quite a few other languages, such as the Java programming language and Microsoft® .NET. Although there are other ways to consume and expose Web services, such as Representational State Transfer (REST), SOAP remains a common way of allowing different platforms to have interoperability. In addition to SOAP modules in the PHP Extension and Application Repository (PEAR) library, a SOAP extension to PHP was introduced in V5. This extension wasn&#39;t enabled by default, so you have to enable the extension or hope your ISP did. In addition, PEAR packages are available that allow you to build SOAP clients and servers, such as the SOAP package.&lt;br /&gt;
&lt;br /&gt;
Unless you change the default, the SOAP extension will be enabled for you in V6. These extensions provide an easy way to implement SOAP clients and SOAP servers, allowing you to build PHP applications that consume and provide Web services.&lt;br /&gt;
&lt;br /&gt;
If SOAP extensions are on by default, that means you won&#39;t have to configure them in PHP. If you develop PHP applications and publish them to an ISP, you may need to check with your ISP to verify that SOAP extensions will be enabled for you when they upgrade.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;XML&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
As of PHP V5.1, XMLReader and XMLWriter have been part of the core of PHP, which makes it easier for you to work with XML in your PHP applications. Like the SOAP extensions, this can be good news if you use SOAP or XML because PHP V6 will be a better fit for you than V4 out of the box.&lt;br /&gt;
&lt;br /&gt;
The XMLWriter and XMLReader are stream-based object-oriented classes that allow you to read and write XML without having to worry about the XML details. &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Things removed&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
In addition to having new features, PHP V6 will not have some other functions and features that have been in previous versions. Most of these things, such as register_globals and safe_mode, are widely considered &quot;broken&quot; in current PHP, as they may expose security risks. In an effort to clean up PHP, the functions and features listed in the next section will be removed, or deprecated, from PHP. Opponents of this removal will most likely cite issues with existing scripts breaking after ISPs or enterprises upgrade to PHP V6, but proponents of this cleanup effort will be happy that the PHP team is sewing up some holes and providing a cleaner, safer implementation.&lt;br /&gt;
&lt;br /&gt;
Features that will be removed from the PHP version include:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;* magic_quotes&lt;br /&gt;
* register_globals&lt;br /&gt;
* register_long_arrays&lt;br /&gt;
* safe_mode&lt;br /&gt;
* ereg removed from the core&lt;br /&gt;
* long variables (i.e. $HTTP_*_VARS)&lt;br /&gt;
* &amp;lt;? &lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;magic_quotes&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Citing portability, performance, and inconvenience, the PHP documentation discourages the use of magic_quotes. It&#39;s so discouraged that it&#39;s being removed from PHP V6 altogether, so before upgrading to PHP V6, make sure that all your code avoids using magic_quotes. If you&#39;re using magic_quotes to escape strings for database calls, use your database implementation&#39;s parameterized queries, if they&#39;re supported. If not, use your database implementation&#39;s escape function, such as mysql_escape_string for MySQL or pg_escape_string for PostgreSQL. Listing 2 shows an example of magic_quotes use.&lt;br /&gt;
&lt;br /&gt;
Using magic_quotes (discouraged)&lt;br /&gt;
&lt;blockquote&gt;&amp;lt;?php&lt;br /&gt;
// Assuming magic_quotes is on...&lt;br /&gt;
$sql = &quot;INSERT INTO USERS (USERNAME) VALUES $_GET[&#39;username&#39;]&quot;;&lt;br /&gt;
?&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After preparing your PHP code for the new versions of PHP, your code should look like that in Listing 3.&lt;br /&gt;
&lt;br /&gt;
Using parameterized queries (recommended)&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&amp;lt;?php&lt;br /&gt;
// Using the proper parameterized query method for MySQL, as an example&lt;br /&gt;
$statement = $dbh-&gt;prepare(&quot;INSERT INTO USERS (USERNAME) VALUES ?&quot;);&lt;br /&gt;
$statement-&gt;execute(array($_GET[&#39;username&#39;]));&lt;br /&gt;
?&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
Now that support for magic_quotes will be completely removed, the get_magic_quotes_gpc() function will no longer be available. This may affect some of the older PHP scripts, so before updating, make sure you fix any locations in which this functions exists.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;register_globals&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
The register_globals configuration key was already defaulted to off in PHP V4.2, which was controversial at the time. When register_globals is turned on, it was easy to use variables that could be injected with values from HTML forms. These variables don&#39;t really require initialization in your scripts, so it&#39;s easy to write scripts with gaping security holes. The register_globals documentation (see Resources) provides much more information about register_globals. See Listing 4 for an example of using register_globals.&lt;br /&gt;
&lt;br /&gt;
Using register_globals (discouraged)&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&amp;lt;?php&lt;br /&gt;
// A security hole, because if register_globals is on, the value for user_authorized&lt;br /&gt;
// can be set by a user sending them on the query string &lt;br /&gt;
// (i.e., http://www.example.com/myscript.php?user_authorized=true)&lt;br /&gt;
if ($user_authorized) {&lt;br /&gt;
    // Show them everyone&#39;s sensitive data...&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;
If your PHP code uses global variables, you should update it. If you don&#39;t update your code to get prepared for newer versions of PHP, consider updating it for security reasons. When you&#39;re finished, your code should look like Listing 5.&lt;br /&gt;
&lt;br /&gt;
Being specific instead (recommended)&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&amp;lt;?php&lt;br /&gt;
function is_authorized() {&lt;br /&gt;
    if (isset($_SESSION[&#39;user&#39;])) {&lt;br /&gt;
        return true;&lt;br /&gt;
    } else {&lt;br /&gt;
        return false;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$user_authorized = is_authorized();&lt;br /&gt;
?&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;strong&gt;register_long_arrays&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
The register_long_arrays setting, when turned on, registers the $HTTP_*_VARS predefined variables. If you&#39;re using the longer variables, update now to use the shorter variables. This setting was introduced in PHP V5 — presumably for backward-compatibility — and the PHP folks recommend turning it off for performance reasons. Listing 6 shows an example of register_long-arrays use.&lt;br /&gt;
&lt;br /&gt;
Using deprecated registered arrays (discouraged)&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&amp;lt;?php&lt;br /&gt;
    // Echo&#39;s the name of the user value given on the query string, like&lt;br /&gt;
    // http://www.example.com/myscript.php?username=ngood&lt;br /&gt;
    echo &quot;Welcome, $HTTP_GET_VARS[&#39;username&#39;]!&quot;;&lt;br /&gt;
?&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
If your PHP code looks like that shown in Listing 6, update it to look like that in Listing 7. Shut off the register_long_arrays setting if it&#39;s on and test your scripts again.&lt;br /&gt;
&lt;br /&gt;
Using $_GET (recommended)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&amp;lt;?php&lt;br /&gt;
    // Using the supported $_GET array instead.&lt;br /&gt;
    echo &quot;Welcome, $_GET[&#39;username&#39;]!&quot;;&lt;br /&gt;
?&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;strong&gt;safe_mode&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
The safe_mode configuration key, when turned on, ensures that the owner of a file being operated on matches the owner of the script that is executing. It was originally a way to attempt to handle security when operating in a shared server environment, like many ISPs would have. (For a link to a list of the functions affected by this safe_mode change, see Resources.) Your PHP code will be unaffected by this change, but it&#39;s good to be aware of it in case you&#39;re setting up PHP in the future or counting on safe_mode in your scripts.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;PHP tags&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Microsoft Active Server Pages (ASP)-style tags — the shorter version of the PHP tags — are no longer supported. To make sure this is not an issue for your scripts, verify that you aren&#39;t using the &lt;% or %&gt; tags in your PHP files. Replace them with &lt;?php and ?&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;FreeType 1 and GD 1&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
The PHP team is removing support for both FreeType 1 and GD 1, citing the age and lack of ongoing developments of both libraries as the reason. Newer versions of both of these libraries are available that provide better functionality. For more information about FreeType and GD, see Resources.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;ereg&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
The ereg extension, which supports Portable Operating System Interface (POSIX) regular expressions, is being removed from core PHP support. If you are using any of the POSIX regex functions, this change will affect you unless you include the ereg functionality. If you&#39;re using POSIX regex today, consider taking the time to update your regex functions to use the Perl-Compatible Regular Expression (PCRE) functions because they give you more features and perform better. Table 1 provides a list of the POSIX regex functions that will not be available after ereg is removed. Their PCRE replacements are also shown. &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&#39;var&#39; to alias &#39;public&#39;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
PHP4 used &#39;var&#39; within classes. PHP5 (in its OO move) caused this to raise a warning under E_STRICT. This warning will be removed in PHP6 and instead &#39;var&#39; will mean the same thing as &#39;public&#39;. This is a nice move but I if anyone has updated their scripts to work under E_STRICT in PHP5 it will be a redundant one for them.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;PHP Engine Additions&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;64 bit integers&lt;/strong&gt;&lt;br /&gt;
A new 64 bit integer will be added (int64). There will be no int32 (it is assumed unless you specify int64)&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;breaking to a label&lt;/strong&gt;&lt;br /&gt;
No &#39;goto&#39; command will be added, but the break keyword will be extended with a static label - so you could do &#39;break foo&#39; and it&#39;ll jump to the label foo: in your code. We can jump the execution into a labeled point.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&amp;lt;?php&lt;br /&gt;
for ($i = 0; $i &lt; 9; $i++)
        {
            if (true) {
                break blah;
            }
            echo &quot;not shown&quot;;
        blah:
            echo &quot;iteration $i\n&quot;;
        }
    ?&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;ifsetor()&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
It looks like we won&#39;t be seeing this one, which is a shame. But instead the ?: operator will have the &#39;middle parameter&#39; requirement dropped, which means you&#39;d be able to do something like this: &quot;$foo = $_GET[&#39;foo&#39;] ?: 42;&quot; (i.e. if foo is true, $foo will equal 42). This should save some code, but I personally don&#39;t think it is as &#39;readable&#39; as ifsetor would have been.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;foreach multi-dim arrays&lt;/strong&gt; &lt;br /&gt;
syntactic sugar&lt;br /&gt;
This is a nice change - you&#39;ll be able to foreach through array lists, i.e. &quot;foreach( $a as $k =&gt; list($a, $b))&quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&amp;lt;?php&lt;br /&gt;
        $a = array(&lt;br /&gt;
            array(1, 2),&lt;br /&gt;
            array(3, 4)&lt;br /&gt;
           );&lt;br /&gt;
        foreach( $a as $k =&gt; list($a, $b)) {&lt;br /&gt;
// blah&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;strong&gt;{} vs []&lt;/strong&gt;&lt;br /&gt;
You can currently use both {} and [] to access string indexes. But the {} notation will raise an E_STRICT in PHP5.1 and will be gone totally in PHP6. Also the [] version will gain substr and array_slice functionality directly - so you could do &quot;[2,]&quot; to access characters 2 to the end, etc. Very handy.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;improvements to []&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
For both strings and arrays, the [] operator will support substr()/array_slice() functionality.&lt;br /&gt;
• [2,3] is elements (or characters) 2, 3, 4&lt;br /&gt;
• [2,] is elements (or characters) 2 to the end&lt;br /&gt;
• [,2] is elements (or characters) 0, 1, 2&lt;br /&gt;
• [,-2] is from the start until the last two elements in the array/string&lt;br /&gt;
• [-3,2] this is the same as substr and array_slice()&lt;br /&gt;
• [,] doesn&#39;t work on the left side of an equation (but does on the right side)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Resources&lt;/strong&gt;&lt;br /&gt;
http://www.ibm.com/developerworks/opensource/library/os-php-future/&lt;br /&gt;
http://www.corephp.co.uk/archives/19-Prepare-for-PHP-6.html&lt;br /&gt;
http://www.php.net/~derick/meeting-notes.html</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/7020613900499476478/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2010/11/new-php-v6-features.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/7020613900499476478'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/7020613900499476478'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2010/11/new-php-v6-features.html' title='New PHP V6 features'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-556021368924763825</id><published>2010-11-15T22:41:00.000-08:00</published><updated>2010-11-17T21:55:56.210-08:00</updated><title type='text'>How to send email from your joomla component</title><content type='html'>&lt;p&gt;Many times you will have the need to send emails from your joomla component. Users want to be notified immediately of changes on their sites,  when a new article has been submitted, or a blog comment has been  posted. Joomla provides email notifications to site administrator when a user has registered on their site.If you want to create a component and that component needs an email functionality, you dont need to create a custom email function for the component. Joomla provides a very helpful class for this.Thats &lt;a href=&quot;http://api.joomla.org/Joomla-Framework/Mail/JMail.html&quot; target=&quot;_blank&quot;&gt;JMail&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;# Set the variables for the email message &lt;br /&gt;  $subject = &quot;Subject for the email  message&quot;;&lt;br /&gt;  $body = &quot;Body of the email message&quot;; &lt;br /&gt;  $to = &quot;user@domainname.com&quot;; &lt;br /&gt;  $from = array(&quot;admin@domainname.com&quot;, &quot;Administrator&quot;); &lt;br /&gt;  &lt;br /&gt; &lt;br /&gt;# Invoke JMail Class&lt;br /&gt;&lt;br /&gt;$mailSender = JFactory::getMailer(); &lt;br /&gt; &lt;br /&gt;# Set the sender array &lt;br /&gt;$mailSender-&gt;setSender($from); &lt;br /&gt; &lt;br /&gt;# Add the recipient - We can assign a single email address or  an array of addresses&lt;br /&gt;&lt;br /&gt;$mailSender-&gt;addRecipient($to); &lt;br /&gt;$mailSender-&gt;setSubject($subject); &lt;br /&gt;$mailSender-&gt;setBody($body); &lt;br /&gt; &lt;br /&gt;# If you would like to send as HTML, include this line. &lt;br /&gt;$mailSender-&gt;isHTML(); &lt;br /&gt;# Send the mail &lt;br /&gt;if (!$mailSender -&amp;gt;Send())&lt;br /&gt;{ &lt;br /&gt;echo &amp;quot;there is an error with the mail&amp;quot;; &lt;br /&gt;}&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;p&gt;That&#39;s all for sending a simple email.If you would like to add carbon copy recipients, include the following before sending the email.&lt;/p&gt;&lt;br /&gt;&lt;blockquote&gt; &lt;br /&gt;&lt;p&gt;$mailSender-&amp;gt;addCC(&quot;carboncopy@domainname.com&quot;);  &lt;br /&gt;&lt;br /&gt;   # Add a blind carbon copy&lt;br&gt;  &lt;br /&gt;$mailSender-&amp;gt;addBCC(&quot;blindcopy@domainname.com&quot;);  &lt;/p&gt;&lt;br /&gt;&lt;p&gt;It also has the option to add attachments.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;If the file is in the server we can give the path.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;$file = JPATH_SITE.&quot;/path/filename.doc&quot;; &lt;br /&gt;  &lt;br&gt;&lt;br /&gt;  $mailSender-&amp;gt;addAttachment($file);  &lt;/blockquote&gt;&lt;br /&gt;&lt;p&gt;If we want to send an user uploaded file, then we have to give the option to upload the file. &lt;br&gt;&lt;br /&gt;  The code is as follows.&lt;br&gt;&lt;br /&gt;  &lt;br&gt;&lt;br /&gt; Change the enctype of the form.&lt;br /&gt; &lt;br&gt;&lt;br /&gt;&lt;blockquote&gt;&amp;lt;form action=&quot;index.php&quot; enctype=&quot;multipart/form-data&quot; method=&quot;post&quot; name=&quot;adminForm&quot;&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;Add a file field within the form.&lt;br /&gt;&lt;br /&gt;  &lt;br&gt;&lt;br /&gt;&lt;blockquote&gt;&amp;lt;input class=&quot;text_area&quot; id=&quot;attachment&quot; maxlength=&quot;250&quot; name=&quot;attachment&quot; size=&quot;32&quot; type=&quot;file&quot;&amp;gt;&lt;/blockquote&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;get the attached file.&lt;br /&gt;  &lt;br&gt;&lt;br /&gt;  &lt;br&gt;&lt;br /&gt; &lt;blockquote&gt; $attachment = JRequest::getVar(&#39;attachment&#39;, null, &#39;files&#39;, &#39;array&#39; );&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;$name_of_uploaded_file =  $attachment[&#39;name&#39;];&lt;br&gt;$config =&amp;amp; JFactory::getConfig();&lt;br&gt;$upload_folder = $config-&amp;gt;getValue(&#39;config.tmp_path&#39;).DS;&lt;br&gt;$path_of_uploaded_file = $upload_folder . $name_of_uploaded_file;&lt;br&gt;$tmp_path = $attachment [&#39;tmp_name&#39;];&lt;br&gt;&lt;br&gt;jimport(&#39;joomla.filesystem.file&#39;);&lt;br&gt;$uploaded = JFile::upload($tmp_path, $path_of_uploaded_file);&lt;br&gt;$mailSender-&amp;gt;addAttachment($path_of_uploaded_file);&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;There are several more methods available in &lt;a href=&quot;http://api.joomla.org/Joomla-Framework/Mail/JMail.html&quot; target=&quot;_blank&quot;&gt;JMail&lt;/a&gt;.&lt;br&gt;  &lt;br /&gt;You should also check out  &lt;a href=&quot;http://api.joomla.org/Joomla-Framework/Mail/JMailHelper.html&quot; target=&quot;_blank&quot;&gt;JMailHelper&lt;/a&gt;.&lt;br&gt;  &lt;br /&gt;It provides several functions to help you secure input from users before passing it along in an email.&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/556021368924763825/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2010/11/how-to-send-email-from-your-joomla.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/556021368924763825'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/556021368924763825'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2010/11/how-to-send-email-from-your-joomla.html' title='How to send email from your joomla component'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-3394462845039863812</id><published>2010-11-15T02:49:00.001-08:00</published><updated>2010-11-17T22:25:32.068-08:00</updated><title type='text'>Adding sortable columns to a joomla component</title><content type='html'>&lt;p&gt;Most of the joomla components have listing of data. And some of them dont have a sorting option in the listing. This tutorial explains that how to add a sortable column in a joomla component. To explain this we are taking the component &#39;com_profiler&#39;.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The joomla the component &#39;com_profiler&#39; is very helpful in profile making. It has a user listing in the administrator side. It lists the users list with name, username, groups, email etc. But this section doesnt have a sorting field. Usually you cant sort any fields in &#39;com_profiler&#39; user list. This section explains how to add a sorting field in the admin section of comprofiler. Now we are going to change the username field in to a &#39;sorting&#39; field.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Usually the user listing is generated by the comprofiler html page and comprofiler controller page. Path for these pages are as follows.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;administrator/components/com_comprofiler/admin.comprofiler.html.php&lt;br /&gt;
&lt;br /&gt;
administrator/components/com_comprofiler/admin.comprofiler.controller.php&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;strong&gt;Step 1 : Modify the admin.comprofiler.html.php&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;In  admin.comprofiler.html.php there is a function named &#39;showUsers&#39;. This function generates the list of users. In the showuser function we will add the &#39;ordering&#39; code&lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;global $mainframe;&lt;br /&gt;
&lt;br /&gt;
$filter_order  = $mainframe-&amp;gt;getUserStateFromRequest( $option.&#39;filter_order&#39;,  &#39;filter_order&#39;,  &#39;u.username&#39;, &#39;cmd&#39; );&lt;br /&gt;
&lt;br /&gt;
$filter_order_Dir = $mainframe-&amp;gt;getUserStateFromRequest( $option.&#39;filter_order_Dir&#39;, &#39;filter_order_Dir&#39;, &#39;asc&#39;,&#39;word&#39; );&lt;br /&gt;
$lists1[&#39;order_Dir&#39;] = $filter_order_Dir;&lt;br /&gt;
&lt;br /&gt;
$lists1[&#39;order&#39;] = $filter_order;&lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
So the page will look like as&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;function showUsers( &amp;amp;$rows, &amp;amp;$pageNav, $search, $option, &amp;amp;$lists, &amp;amp;$pluginColumns ) {&lt;br /&gt;
&lt;br /&gt;
HTML_comprofiler::secureAboveForm(&#39;showUsers&#39;);&lt;br /&gt;
&lt;br /&gt;
// table ordering&lt;br /&gt;
&lt;br /&gt;
global $mainframe;&lt;br /&gt;
&lt;br /&gt;
$filter_order  = $mainframe-&amp;gt;getUserStateFromRequest( $option.&#39;filter_order&#39;,  &#39;filter_order&#39;,  &#39;u.username&#39;, &#39;cmd&#39; );&lt;br /&gt;
&lt;br /&gt;
$filter_order_Dir = $mainframe-&amp;gt;getUserStateFromRequest( $option.&#39;filter_order_Dir&#39;, &#39;filter_order_Dir&#39;, &#39;u.username&#39;,&#39;word&#39; );&lt;br /&gt;
$lists1[&#39;order_Dir&#39;] = $filter_order_Dir;&lt;br /&gt;
&lt;br /&gt;
$lists1[&#39;order&#39;] = $filter_order;&lt;br /&gt;
&lt;br /&gt;
outputCbTemplate( 2 );&lt;br /&gt;
&lt;br /&gt;
outputCbJs( 2 );&lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step 2 : Setting the Order Link&lt;/strong&gt;&lt;br /&gt;
&lt;p&gt;After that we can set the sorting link to the username field. Place the following code instead of the &#39;Usernmae&#39; Title.&lt;/p&gt;&lt;br /&gt;
&lt;blockquote&gt;&amp;lt;?php echo JHTML::_( &#39;grid.sort&#39;, &#39;UserName&#39;, &#39;u.username&#39;, $lists1[&#39;order_Dir&#39;], $lists1[&#39;order&#39;]); ?&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;So the code will look like as follows.&lt;/p&gt;&lt;br /&gt;
&lt;blockquote&gt;&amp;lt;th width=&amp;quot;15%&amp;quot; class=&amp;quot;title&amp;quot;&amp;gt;&amp;lt;?php echo CBTxt::T(&#39;Name&#39;); ?&amp;gt;&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;th width=&amp;quot;10%&amp;quot; class=&amp;quot;title&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?php echo JHTML::_( &#39;grid.sort&#39;, &#39;UserName&#39;, &#39;u.username&#39;, $lists1[&#39;order_Dir&#39;], $lists1[&#39;order&#39;]); ?&amp;gt;&amp;lt;/th&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;th width=&amp;quot;5%&amp;quot; class=&amp;quot;title&amp;quot; nowrap=&amp;quot;nowrap&amp;quot;&amp;gt;&amp;lt;?php echo CBTxt::T(&#39;Logged In&#39;); ?&amp;gt;&amp;lt;/th&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;&lt;strong&gt;Step 3 : Add the Hidden Fields&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Also add the hidden fields to post the sorting field and sorting direction to the controller page. Add the following code before the end of the form&lt;/p&gt;&lt;br /&gt;
&lt;blockquote&gt;&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;filter_order&amp;quot; value=&amp;quot;&amp;lt;?php echo $lists1[&#39;order&#39;]; ?&amp;gt;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;filter_order_Dir&amp;quot; value=&amp;quot;&amp;lt;?php echo $lists1[&#39;order_Dir&#39;]; ?&amp;gt;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;/blockquote&gt;&lt;p&gt;now the code will look like as follows.&lt;/p&gt;&lt;br /&gt;
&lt;blockquote&gt;&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;option&amp;quot; value=&amp;quot;&amp;lt;?php echo $option;?&amp;gt;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;task&amp;quot; value=&amp;quot;showusers&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;boxchecked&amp;quot; value=&amp;quot;0&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;filter_order&amp;quot; value=&amp;quot;&amp;lt;?php echo $lists1[&#39;order&#39;]; ?&amp;gt;&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;filter_order_Dir&amp;quot; value=&amp;quot;&amp;lt;?php echo $lists1[&#39;order_Dir&#39;]; ?&amp;gt;&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
echo cbGetSpoofInputTag( &#39;user&#39; );&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;&lt;strong&gt;Step 4 : Modify the controller code (admin.comprofiler.controller.php)&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The controller grabs the data from the database.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;So we need to modify the function to list based on the order. &lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
The controller contains a function named &#39;showUsers&#39;.Edit the function to get the post values submitted from the listng page. Use the post method to assign the values. After placing the code the function will look like as&lt;/p&gt;&lt;br /&gt;
&lt;blockquote&gt;function showUsers( $option ) {&lt;br /&gt;
&lt;br /&gt;
global $_CB_database, $_CB_framework, $_POST, $_PLUGINS, $_CB_TxtIntStore;&lt;br /&gt;
&lt;br /&gt;
if(isset($_POST[&#39;filter_order&#39;]))&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$filter_order = $_POST[&#39;filter_order&#39;];&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$filter_order = &amp;quot;u.username&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if(isset($_POST[&#39;filter_order_Dir&#39;]))&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $filter_order_Dir = $_POST[&#39;filter_order_Dir&#39;];&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$filter_order_Dir = &amp;quot;asc&amp;quot;;&lt;br /&gt;
&lt;/blockquote&gt;&lt;p&gt;Also modify the search query to get the ordered data.Add the &#39; ORDER BY&#39; clause in the search query. After adding the &#39; ORDER BY &#39; clause the code will look like as the follow.&lt;/p&gt;&lt;br /&gt;
&lt;blockquote&gt;$query      = &amp;quot;SELECT DISTINCT u.*, g.name AS groupname, ue.approved, ue.confirmed&amp;quot;&lt;br /&gt;
&lt;br /&gt;
. $queryFrom&lt;br /&gt;
&lt;br /&gt;
. &amp;quot; ORDER BY $filter_order $filter_order_Dir &amp;quot;&lt;br /&gt;
&lt;br /&gt;
. &amp;quot;\n LIMIT &amp;quot; . (int) $pageNav-&amp;gt;limitstart . &amp;quot;, &amp;quot; . (int) $pageNav-&amp;gt;limit&lt;br /&gt;
&lt;br /&gt;
;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;That&#39;s all. Now in the user listing of the admin panel we have the &#39;user name &#39; filed as link. Now we can list the data&#39;s either in ascending order or by descending order.&lt;br /&gt;
&lt;br /&gt;
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/3394462845039863812/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2010/11/adding-sortable-columns-to-joomla.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/3394462845039863812'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/3394462845039863812'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2010/11/adding-sortable-columns-to-joomla.html' title='Adding sortable columns to a joomla component'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-1761704826699726691</id><published>2010-11-10T21:49:00.000-08:00</published><updated>2010-11-10T21:50:05.567-08:00</updated><title type='text'>Twitter Application development</title><content type='html'>&lt;h2&gt;&lt;br /&gt;    &lt;strong&gt;What is twitter&lt;/strong&gt;&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;  Twitter is a status-updating or microblogging social  networking website. It is a breakthrough in social networking because  it takes communication into another level. Before, a person can only update his  status (e.g. what he&#39;s doing, where he is) at a certain time. But with Twitter  and its mobile integration, he can update his status almost all throughout the  day and get in touch with people that matters to him the most.&lt;br&gt;&lt;br /&gt;  &lt;br&gt;&lt;br /&gt;  But the functions of Twitter do not stop there. It is now used by various  fields. Business, for example, has used Twitter to get in touch with customers  on a personal level. It is also a nice place to meet people from different  parts of the world that shares the same interests. Furthermore, its possibilities  to promote new technology, news and products can&#39;t be denied. &lt;br&gt;&lt;br /&gt;  Twitter have been used by companies, bloggers and  agencies to promote their brand&lt;/p&gt;&lt;br /&gt;&lt;h2&gt;&lt;strong&gt;Advantages  and disadvantages of using Twitter for Internet Marketing &lt;/strong&gt;&lt;/h2&gt;&lt;br /&gt;&lt;h4&gt;&lt;strong&gt;Advantages  of twitter&lt;/strong&gt;&lt;/h4&gt;&lt;br /&gt;&lt;p&gt;  Your  Internet marketing can be done free of cost if you use Twitter wisely. Your  target market is out there for you to seek and understand. Understand from  their tweets, their passion and interests. Do your research on your target  market by following the tweets of your target market for better understanding.  Identify the strategies used by your competitors by following their tweets as  well.&lt;br&gt;&lt;br /&gt;  Twitter  allows you to network efficiently and with large groups of people. Twitter and  its third party applications allow you to segregate and interact with your  target markets effectively. You can direct your Internet marketing campaigns at  relevant groups efficiently by using Twitter&lt;br&gt;&lt;br /&gt;  Twitter allows you to communicate directly with your  target market instantly. Normally, the process of communication takes time. For  example, if you have a Website, the communication would be via polls, which are  not personal or though contact forms which are time consuming and impersonal as  well. With twitter, you can expect instant communication with your target  market. You may have just posted a tweet, but a reply from your target market  could come in an instant as well. Twitter helps you to gather real time  intelligence from your very own target market as well as obtain valuable  feedback. The speed of communication is just fantastic with Twitter. Moreover,  your near approach helps to builds lasting relationship as you will come cross  as a company that cares for its consumers instead of just hard selling.&lt;br&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;&lt;strong&gt;Disadvantages of twitter&lt;/strong&gt;&lt;/h4&gt;&lt;br /&gt;&lt;p&gt;  Twitter  is the number one site for spammers. You will have to filter and weed out  spammers from your lists from time to time, if you want to have a good gauge of  your target market. Otherwise, the followers total will be an inflated number  which will not help in your Internet marketing campaigns. Filtering spam tweets  is a lot of hard work. Other means of Internet marketing may seem feasible in  the long run.&lt;br&gt;&lt;br /&gt;  &lt;br&gt;&lt;br /&gt;  Twitter  has no applications rather than other sites like Facebook, Friendster and  MySpace. It also has no groups, videos, blogs, classified ads, forums,  marketplace and other unique and popular social networking menus. You can only  upload one picture, which is your avatar and must be small, compare to other  social networks which you can upload pictures as many as you want. You also  cannot upload music files here on Twitter, but you can upload on the other  social networks.&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;&lt;strong&gt;What does twitter do for businesses?&lt;/strong&gt;&lt;/h4&gt;&lt;br /&gt; Twitter is a  communication platform that helps businesses stay connected to their customers.  As a business, you can use it to quickly share information with people  interested in your company, gather real-time market intelligence and feedback,  and build relationships with customers, partners and other people who care  about your company. As an individual user, you can use Twitter to tell a  company (or anyone else) that you&#39;ve had a great—or disappointing—experience  with their business, offer product ideas, and learn about great offers.&lt;br /&gt;&lt;h4&gt;How does it work?&lt;/h4&gt;&lt;br /&gt;&lt;p&gt;Twitter lets you write and read messages of up to 140 characters, or the  very length of this sentence, including all punctuation and spaces. The  messages are public and you decide what sort of messages you want to  receive—Twitter being a recipient driven information network. In addition, you  can send and receive Twitter messages, or tweets, equally well from your  desktop or your mobile phone.&lt;br&gt;&lt;br /&gt;  When you combine messages that are quick to write, easy to read, public,  controlled by the recipient and exchangeable anywhere, you’ve got a powerful,  real-time way to communicate. And real-time communication is turning out to be  ground-breaking for users and businesses alike.&lt;/p&gt;&lt;br /&gt;&lt;h2&gt;How do businesses use Twitter?&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;Twitter connects you to your customers right now, in a way that was never  before possible. For example, let’s say you work for a custom bike company. If  you run a search for your brand, you may find people posting messages about how  happy they are riding your bikes in the French Alps—giving you a chance to  share tips about cyclist-friendly cafes along their route.&lt;br&gt;&lt;br /&gt;  Others may post minor equipment complaints or desired features that they  would never bother to contact you about—providing you with invaluable customer  feedback that you can respond to right away or use for future planning. Still  others may twitter about serious problems with your bikes—letting you offer  customer service that can turn around a bad situation.&lt;br&gt;&lt;br /&gt;  You don’t have to run a bike shop or a relatively small company to get good  stuff out of Twitter. Businesses of all kinds, including major brands, increasingly  find that listening and engaging on the service leads to happier customers,  passionate advocates, key product improvements and, in many cases, more sales.&lt;/p&gt;&lt;br /&gt;&lt;h3&gt;A key benefit &lt;/h3&gt;&lt;br /&gt;&lt;p&gt;One of Twitter’s key benefits is that it gives you the chance to communicate  casually with customers on their terms, creating friendly relationships along  the way—tough for corporations to do in most other mediums.&lt;br&gt;&lt;br /&gt;  But Twitter isn’t just about useful immediacy. The conversational nature of  the medium lets you build relationships with customers, partners and other  people important to your business. Beyond transactions, Twitter gives your  constituents direct access to employees and a way to contribute to your  company; as marketers say, it shrinks the emotional distance between your company  and your customers. Plus, the platform lends itself to integration with your  existing communication channels and strategies. In combination, those factors  can make Twitter a critical piece of your company’s bigger digital footprint.&lt;br&gt;&lt;br /&gt;  For instance, let’s say you run a big retail website. In addition to  learning more about what your customers want, you can provide exclusive Twitter  coupon codes, link to key posts on your blog, share tips for shopping online,  and announce specials at store locations. And you can take things a step  further by occasionally posting messages about fun, quirky events at your HQ,  giving others a small but valuable connection with the people in your company.&lt;br&gt;&lt;br /&gt;  Tip: Companies sometimes worry that twittering might require a lot of staff  time or even hiring new people to maintain an account. In fact, Twitter works  best for businesses when you start slow, devoting a few minutes a day to see  whether and how it’s valuable to you.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Twitter Application development&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;  We need  to use the Twitter API and Twitter Content to develop a Service to search,  display, analyze, retrieve, view, and submit information to or on Twitter&lt;br&gt;&lt;br /&gt;  &lt;/p&gt;&lt;br /&gt;&lt;h4&gt;&lt;strong&gt;Twitter API&lt;/strong&gt;&lt;/h4&gt;&lt;br /&gt;&lt;p&gt;  http://dev.twitter.com/pages/api_overview&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/1761704826699726691/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2010/11/twitter-application-development.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/1761704826699726691'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/1761704826699726691'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2010/11/twitter-application-development.html' title='Twitter Application development'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-2283742866738606407</id><published>2010-11-10T20:46:00.000-08:00</published><updated>2010-11-10T21:13:48.454-08:00</updated><title type='text'>Face book Application Development</title><content type='html'>&lt;p&gt;Facebook  is one of the fastest growing social networking websites and is quickly  becoming a powerful and cost effective portal, ideal for organizations to  create that ‘brand connection’ in the Web2.0 world.&lt;br&gt;&lt;br /&gt;  &lt;a href=&quot;http://www.facebook.com&quot;&gt;http://www.facebook.com&lt;/a&gt; &lt;/p&gt;&lt;br /&gt;&lt;h2&gt;&lt;strong&gt;What are Facebook applications?&lt;/strong&gt;&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;  Facebook  applications are the software programs that allow users to connect, interact  and entertain themselves and their ‘friends’.&lt;br&gt;&lt;br /&gt;  Most Facebook users today use 3rd party Facebook applications to add some  fun and personality to their Facebook profile. Their purpose is to generate  content that the user finds is relevant or of interest to them.&lt;br&gt;&lt;br /&gt;  There is virtually an application for everything, ranging from  a&amp;nbsp;Facebook application that reminds a user when their favorite band is  coming to town to a slide show of a collection of sentimental photos. The great  thing about Facebook applications is that if it is to be added to a profile,  the users listed as a individual’s ‘friends’ are sent&amp;nbsp;an option of also  using it. The application then circulates at such a rapid rate exposure is  viral.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;  Now a day’s most company’s developing facebook applications like gaming,  interactive interfaces to promote their products etc.&lt;br&gt;&lt;br /&gt;  &lt;a href=&quot;http://www.facebook.com/apps/directory.php&quot;&gt;http://www.facebook.com/apps/directory.php&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;  Many site are integrated their facebook features into their sites&lt;br&gt;&lt;br /&gt;  &lt;a href=&quot;http://developers.facebook.com/showcase/&quot;&gt;http://developers.facebook.com/showcase/&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;h2&gt;&lt;strong&gt;Facebook Application Development&lt;/strong&gt;&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;  We can create an application completely focused on our  business brand. Think of a travel application that links to booking information  on our website or a product catalogue of our latest products. All applications  are designed to generate maximum interest on our business and draw continual  international traffic to our website. &lt;br&gt;&lt;br /&gt;  &lt;a href=&quot;http://developers.facebook.com/&quot;&gt;http://developers.facebook.com/&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;h2&gt;&lt;strong&gt;How to create a  Facebook  Application&lt;/strong&gt;&lt;br&gt;&lt;br /&gt;&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;To  create an application we need to register our application with facebook. Also  we need to install the facebook developer kit.  Using the facebook application we can access  information about the facebook profile even the non public information. For  example if a facebook user register with our site , we can use facebook login  for registering. If the user login with facebook we can collect the public  information of the user including the emailid. So no need to confirm the email again,  because it Is already confirmed by facebook. Also we can collect address, phone  no, gender etc.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Tutorials to develop a Facebook application&lt;br&gt;&lt;br /&gt;&lt;a href=&quot;http://developers.facebook.com/&quot;&gt;http://developers.facebook.com/&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;h2&gt;&lt;strong&gt;Scope of facebook social plug-in    &lt;/strong&gt;&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;  A reader on your site, who is logged into her Facebook account, can now give  your story a “Thumbs up” by simply clicking this Like button. She will also  have to option to publish a snippet of your blog story on to her Facebook  profile.&lt;br&gt;&lt;br /&gt;  Then you have the Activity widget that shows in near real-time how people  are interacting with your stories. If the user is logged into Facebook, the  activity widget will show the activity of her friends on your web site else  it’ll show everyone’s activity.&lt;br&gt;&lt;br /&gt;  However, the most exciting social plug in for Facebook in the new recommendations  engine. It shows a list of most popular stories on your blog as determined by  the count of Facebook users who have “liked” that story.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;To get started, we need to add our domain name to  Facebook.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href=&quot;http://www.facebook.com/insights/&quot;&gt;http://www.facebook.com/insights/&lt;/a&gt; &lt;/p&gt;&lt;br /&gt;&lt;p&gt;  We basically need to verify that we are the actual owner of the domain and  we can do this by simply adding a unique HTML META tag to our blog header.&lt;br&gt;&lt;br /&gt;  Facebook will check the tag in our blog and once it’s verified, we can link  the reports to either our Facebook profile or any Facebook page, if we own one.&lt;br&gt;&lt;br /&gt;  Once everything is in place, we can revisit the Facebook Insights page to  get detailed sharing stats of our blog pages. It will even tell us the top  countries / cities of users who are interacting with our stories including the  demographics.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;If you have a forum or a blog site that requires  registration, you may also explore the Sign-on widget that will let user  registers on your site using their Facebook ID&lt;br&gt;&lt;br /&gt;This new tools from makes it possible for websites  to allow you to connect with your friends and their likings. It helps you get  first hand views and reviews from friends about the new movie which is the talk  of the town, or the menu in any restaurant or the latest news. Not that it  doesn’t allow strangers to give their feedback but it makes it possible for  your friends to stand prominently.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;The plugins makes it possible to show your action in  the following ways you can either ‘like’ content, or you can ‘recommend’ such  contents.  This makes it possible for you  to connect with any content that you like publicly.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Alternately the tool also helps to remove or  ‘unlike’ any new content or previously liked content. Another possible way is  through the activity feed. This lets you know what your friends are doing with  their likes and recommendations while visiting a particularly popular website.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Social plugins&lt;/strong&gt;&lt;br&gt;&lt;br /&gt;  All social plugins are extensions of Facebook and  are specifically designed so none of our data is shared with the sites on which  they appear.&lt;br&gt;&lt;br /&gt;We can add these plugins into our site by adding a  group of code into our website.&lt;/p&gt;&lt;br /&gt;&lt;h3&gt;&lt;strong&gt;Facebook  Plugins&lt;/strong&gt;&lt;/h3&gt;&lt;br /&gt;&lt;h4&gt;1: Like Button&lt;/h4&gt;&lt;br /&gt;&lt;p&gt;The Like button lets a user share your content with friends on Facebook.  When the user clicks the Like button on your site, a story appears in the  user&#39;s friends&#39; News Feed with a link back to your website.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href=&quot;http://developers.facebook.com/docs/reference/plugins/like&quot;&gt;http://developers.facebook.com/docs/reference/plugins/like&lt;/a&gt;&lt;br&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;2: Activity Feed&lt;/h4&gt;&lt;br /&gt;&lt;p&gt;The Activity Feed plugin  displays the most interesting recent activity taking place on your site. Since  the content is hosted by Facebook, the plugin can display personalized content  whether or not the user has logged into your site. The activity feed displays  stories both when users &lt;a href=&quot;http://developers.facebook.com/docs/reference/plugins/like&quot;&gt;like&lt;/a&gt; content on your site and when  users share content from your site back to Facebook.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href=&quot;http://developers.facebook.com/docs/reference/plugins/activity&quot;&gt;http://developers.facebook.com/docs/reference/plugins/activity&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;3: Comments&lt;/h4&gt;&lt;br /&gt;&lt;p&gt;The Comments Box easily enables your users to comment on your site&#39;s content  — whether it&#39;s for a web page, article, photo, or other piece of content. Then  the user can share the comment on Facebook on their Wall and in their friends&#39;  streams.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href=&quot;http://developers.facebook.com/docs/reference/plugins/comments&quot;&gt;http://developers.facebook.com/docs/reference/plugins/comments&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Sample code&lt;/strong&gt;&lt;br&gt;&lt;br /&gt;&amp;lt;div id=&amp;quot;fb-root&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;script  src=&amp;quot;http://connect.facebook.net/en_US/all.js#appId=APP_ID&amp;amp;amp;xfbml=1&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;fb:comments  xid=&amp;quot;1234&amp;quot; width=&amp;quot;425&amp;quot;&amp;gt;&amp;lt;/fb:comments&amp;gt;&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;4: Facepile&lt;/h4&gt;&lt;br /&gt;&lt;p&gt;The Facepile plugin shows the Face book profile pictures of the user&#39;s  friends who have already signed up for your site.&lt;br&gt;&lt;br /&gt;  You can specify the maximum number of rows of profile pictures to display.  The plugin dynamically sizes its height; for example, if you specify a maximum  of four rows, and there are only enough friends to fill two rows, the height of  the plugin will be only what is needed for two rows of profile pictures. The  plugin doesn&#39;t render if the user is logged out of Facebook or doesn&#39;t have  friends who have signed up for your site using Facebook.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;  &lt;strong&gt;Sample code&lt;/strong&gt;&lt;br&gt;&lt;br /&gt;&amp;lt;div id=&amp;quot;fb-root&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;script  src=&amp;quot;http://connect.facebook.net/en_US/all.js#appId=APP_ID&amp;amp;amp;xfbml=1&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;lt;fb:facepile  max-rows=&amp;quot;5&amp;quot; width=&amp;quot;600&amp;quot;&amp;gt;&amp;lt;/fb:facepile&amp;gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href=&quot;http://developers.facebook.com/docs/reference/plugins/facepile&quot;&gt;http://developers.facebook.com/docs/reference/plugins/facepile&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;5: Like Box&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;  The Like Box is  a social plugin that enables &lt;a href=&quot;http://www.facebook.com/advertising/?pages&quot;&gt;Facebook Page&lt;/a&gt; owners to attract and gain Likes from their own website.  The Like Box enables users to:&lt;/p&gt;&lt;br /&gt;&lt;ul type=&quot;disc&quot;&gt;&lt;br /&gt;  &lt;li&gt;See how many users already like       this page, and which of their friends like it too&lt;/li&gt;&lt;br /&gt;  &lt;li&gt;Read recent posts from the page&lt;/li&gt;&lt;br /&gt;  &lt;li&gt;Like the page with one click,       without needing to visit the page&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p&gt;&lt;a href=&quot;http://developers.facebook.com/docs/reference/plugins/like-box&quot;&gt;http://developers.facebook.com/docs/reference/plugins/like-box&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;6: Live Stream&lt;/h4&gt;&lt;br /&gt;&lt;p&gt;The Live Stream plugin lets users visiting your site or application share  activity and comments in real time. Live Stream works best when you are running  a real-time event, like live streaming video for concerts, speeches, or  webcasts, live Web chats, webinars, massively multiplayer games.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href=&quot;http://developers.facebook.com/docs/reference/plugins/live-stream&quot;&gt;http://developers.facebook.com/docs/reference/plugins/live-stream&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;7: Login Button&lt;/h4&gt;&lt;br /&gt;&lt;p&gt;The Login Button shows profile pictures of the user&#39;s friends who have  already signed up for your site in addition to a login button.&lt;br&gt;&lt;br /&gt;  You can specify the maximum number of rows of faces to display. The plugin  dynamically sizes its height; for example, if you specify a maximum of four  rows of faces, and there are only enough friends to fill two rows, the height  of the plugin will be only what is needed for two rows of faces.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href=&quot;http://developers.facebook.com/docs/reference/plugins/login&quot;&gt;http://developers.facebook.com/docs/reference/plugins/login&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;8: Recommendations&lt;/h4&gt;&lt;br /&gt;&lt;p&gt;The Recommendations plugin shows personalized recommendations to your users.  Since the content is hosted by Facebook, the plugin can display personalized  recommendations whether or not the user has logged into your site. To generate  the recommendations, the plugin considers all the social interactions with URLs  from your site. For a logged in Facebook user, the plugin will give preference  to and highlight objects her friends have interacted with.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href=&quot;http://developers.facebook.com/docs/reference/plugins/recommendations&quot;&gt;http://developers.facebook.com/docs/reference/plugins/recommendations&lt;/a&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/2283742866738606407/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2010/11/face-book-application-development.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/2283742866738606407'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/2283742866738606407'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2010/11/face-book-application-development.html' title='Face book Application Development'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-8317277497452611866</id><published>2010-11-10T02:49:00.000-08:00</published><updated>2010-11-17T22:21:34.022-08:00</updated><title type='text'>Replace a string in the mysql database using REPLACE function</title><content type='html'>&lt;p&gt;Many times we have the need to change the values of database fields. If our table contains thousands of records, its not possible to manually edit the records. So we can use MySQL REPLACE function to replace the string. The syntax to use the replace function is as follows.&lt;/p&gt;&lt;br /&gt;
&lt;blockquote&gt;UPDATE `table_name` SET `field_name` = REPLACE(`field_name`, &#39;Keyword to be replaced&#39;, &#39;Replacement String&#39;);&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;For example if we have changed the website name , we also need to change the datas in the downloads table (if we have).  &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Now we can use a single sql query with REPLACE function , and it will affect the whole records.  &lt;/p&gt;&lt;br /&gt;
&lt;blockquote&gt;UPDATE `tbl_downloads` SET `sitename` = REPLACE(`sitename`, &#39;www.old-sitename.com&#39;, &#39;www.new-sitename.com&#39;);&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;now all the datas with &#39;old-sitename&#39; will replace with the new-sitename &lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/8317277497452611866/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2010/11/replace-string-in-mysql-database-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/8317277497452611866'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/8317277497452611866'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2010/11/replace-string-in-mysql-database-using.html' title='Replace a string in the mysql database using REPLACE function'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-3933655950241740334</id><published>2010-11-10T01:01:00.001-08:00</published><updated>2010-11-17T22:19:56.046-08:00</updated><title type='text'>Romove the title from the vimeo video.</title><content type='html'>&lt;p&gt;Usually we are using iframe to embedd a vimeo video.&lt;br /&gt;
&lt;br /&gt;
It similar as the follow.&lt;/p&gt;&lt;br /&gt;
&lt;blockquote&gt;&amp;lt;iframe src=&amp;quot;http://player.vimeo.com/video/123456789&amp;quot; width=&amp;quot;400&amp;quot; height=&amp;quot;300&amp;quot; frameborder=&amp;quot;0&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;http://vimeo.com/123456789&amp;quot;&amp;gt;Video Title&amp;lt;/a&amp;gt; from &amp;lt;a href=&amp;quot;http://vimeo.com/user123456&amp;quot;&amp;gt;vimeo user&amp;lt;/a&amp;gt; on &amp;lt;a href=&amp;quot;http://vimeo.com&amp;quot;&amp;gt;Vimeo&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;While embedding with the iframe code the video title also with the video&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;If we want to remove the title and video owner name from the vimeo video , we can use embedd code .&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The code will similar as the follow.&lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&amp;lt;object width=&amp;quot;400&amp;quot; height=&amp;quot;300&amp;quot;&amp;gt;&amp;lt;param name=&amp;quot;allowfullscreen&amp;quot; value=&amp;quot;true&amp;quot; /&amp;gt;&amp;lt;param name=&amp;quot;allowscriptaccess&amp;quot; value=&amp;quot;always&amp;quot; /&amp;gt;&amp;lt;param name=&amp;quot;movie&amp;quot; value=&amp;quot;http://vimeo.com/moogaloop.swf?clip_id=123456789&amp;amp;amp;server=vimeo.com&amp;amp;amp;show_title=0&amp;amp;amp;show_byline=0&amp;amp;amp;show_portr ait=0&amp;amp;amp;color=&amp;amp;amp;fullscreen=1&amp;quot; /&amp;gt;&amp;lt;embed src=&amp;quot;http://vimeo.com/moogaloop.swf?clip_id=123456789&amp;amp;amp;server=vimeo.com&amp;amp;amp;show_title=0&amp;amp;amp;show_byline=0&amp;amp;amp;show_portr ait=0&amp;amp;amp;color=&amp;amp;amp;fullscreen=1&amp;quot; type=&amp;quot;application/x-shockwave-flash&amp;quot; allowfullscreen=&amp;quot;true&amp;quot; allowscriptaccess=&amp;quot;always&amp;quot; width=&amp;quot;400&amp;quot; height=&amp;quot;300&amp;quot;&amp;gt;&amp;lt;/embed&amp;gt;&amp;lt;/object&amp;gt;&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;http://vimeo.com/123456789&amp;quot;&amp;gt;Video Title&amp;lt;/a&amp;gt; from &amp;lt;a href=&amp;quot;http://vimeo.com/user123456&amp;quot;&amp;gt;vimeo user&amp;lt;/a&amp;gt; on &amp;lt;a href=&amp;quot;http://vimeo.com&amp;quot;&amp;gt;Vimeo&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/3933655950241740334/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2010/11/romove-title-from-vimeo-video.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/3933655950241740334'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/3933655950241740334'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2010/11/romove-title-from-vimeo-video.html' title='Romove the title from the vimeo video.'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-2729900633870251387</id><published>2010-09-27T22:21:00.000-07:00</published><updated>2010-12-13T22:23:41.655-08:00</updated><title type='text'>How to check upload file extension using JavaScript ?</title><content type='html'>The following is a simple JavaScript function to check the extension of an uploading file.&lt;br /&gt;
It will help to avoid checking the file extension in server, if the JavaScript is enabled in the browser.&lt;br /&gt;
&lt;br /&gt;
We use a form for file uploading. The form is similar as follows.&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&amp;lt;form name=&amp;quot;a&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;input type=&amp;quot;file&amp;quot; name=&amp;quot;shw_image&amp;quot; id=&amp;quot;shw_image&amp;quot;  onchange=&amp;quot;validateFileExtension(this.value)&amp;quot;/&amp;gt; &lt;br /&gt;
&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;tmp_img&amp;quot; id=&amp;quot;tmp_img&amp;quot; value=&amp;quot;&amp;quot; /&amp;gt; &lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&lt;/div&gt;Next using the JavaScript function we can find out the file extension. We are calling this function in the onchange event of the file filed.&lt;br /&gt;
The JavaScript function is as follows.&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;function validateFileExtension(fld) &lt;br /&gt;
{&lt;br /&gt;
 &lt;br /&gt;
  document.getElementById(&quot;tmp_img&quot;).value= fld;&lt;br /&gt;
  var ext = fld;&lt;br /&gt;
  ext = ext.substring(ext.length-3,ext.length);&lt;br /&gt;
  ext = ext.toLowerCase();&lt;br /&gt;
  if((ext != &#39;jpg&#39;)&amp;&amp;(ext != &#39;gif&#39;)&amp;&amp;(ext != &#39;png&#39;)&amp;&amp;(ext != &#39;jpeg&#39;))&lt;br /&gt;
  {&lt;br /&gt;
  alert(&#39;You selected a .&#39;+ ext + &#39; file; \n please select a .jpg/.gif/.png/.jpeg  image file&#39;);&lt;br /&gt;
  document.frm.product_image.focus();&lt;br /&gt;
  document.frm.product_image.value=&quot;&quot;;&lt;br /&gt;
  document.getElementById(&quot;tmp_img&quot;).value=&quot;&quot;;&lt;br /&gt;
  return false;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;/div&gt;This function alerts a message if we select a file with the extension other than jpg, gif, png and jpeg.</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/2729900633870251387/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2010/09/how-to-check-upload-file-extension.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/2729900633870251387'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/2729900633870251387'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2010/09/how-to-check-upload-file-extension.html' title='How to check upload file extension using JavaScript ?'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-5060090272502005311</id><published>2010-08-17T02:41:00.000-07:00</published><updated>2010-12-07T02:43:02.787-08:00</updated><title type='text'>PHP Parser to extract Filezilla FTP details</title><content type='html'>The following is a PHP program to extract FTP usernames and passwords from the filezilla xml file.&lt;br /&gt;
First export the filezilla FTP details using the export option in the filezilla&lt;br /&gt;
File - &gt; Export&lt;br /&gt;
&lt;br /&gt;
Save this file as &#39;FileZilla.xml&#39;&lt;br /&gt;
&lt;br /&gt;
Assign the xml file path to the variable and reun the program. It will list the ftp details . Add or change the xml_key variable to get the other details of FTP details.&lt;br /&gt;
&lt;br /&gt;
Source Code&lt;br /&gt;
&lt;div class=&quot;codedisplay&quot;&gt;&amp;lt;?php&lt;br /&gt;
  $xml_file  = &amp;quot;FileZilla.xml&amp;quot;;&lt;br /&gt;
$xml_host_key  =  &amp;quot;*FILEZILLA3*SERVERS*SERVER*HOST&amp;quot;;&lt;br /&gt;
  $xml_port_key = &amp;quot;*FILEZILLA3*SERVERS*SERVER*PORT&amp;quot;;&lt;br /&gt;
  $xml_user_key  =  &amp;quot;*FILEZILLA3*SERVERS*SERVER*USER&amp;quot;;&lt;br /&gt;
  $xml_pass_key = &amp;quot;*FILEZILLA3*SERVERS*SERVER*PASS&amp;quot;;&lt;br /&gt;
  $xml_name_key = &amp;quot;*FILEZILLA3*SERVERS*SERVER*NAME&amp;quot;;&lt;br /&gt;
$story_array = array();&lt;br /&gt;
$counter = 0;&lt;br /&gt;
  class xml_story{&lt;br /&gt;
  var $host, $port,$user,$pass;&lt;br /&gt;
  }&lt;br /&gt;
function startTag($parser, $data){&lt;br /&gt;
  global $current_tag;&lt;br /&gt;
  $current_tag .= &amp;quot;*$data&amp;quot;;&lt;br /&gt;
  }&lt;br /&gt;
function endTag($parser, $data){&lt;br /&gt;
  global $current_tag;&lt;br /&gt;
  $tag_key = strrpos($current_tag, &#39;*&#39;);&lt;br /&gt;
  $current_tag = substr($current_tag, 0, $tag_key);&lt;br /&gt;
  }&lt;br /&gt;
function contents($parser, $data){&lt;br /&gt;
  global $current_tag, $xml_host_key, $xml_port_key, $counter, $story_array,$xml_user_key,$xml_pass_key,$xml_name_key;&lt;br /&gt;
  switch($current_tag){&lt;br /&gt;
  case $xml_host_key:&lt;br /&gt;
  $story_array[$counter] = new xml_story();&lt;br /&gt;
  $story_array[$counter]-&amp;gt;host = $data;&lt;br /&gt;
  break;&lt;br /&gt;
  case $xml_port_key:&lt;br /&gt;
  &lt;br /&gt;
  $story_array[$counter]-&amp;gt;port = $data;&lt;br /&gt;
  //$counter++;&lt;br /&gt;
  break;&lt;br /&gt;
  case $xml_user_key:&lt;br /&gt;
  &lt;br /&gt;
  $story_array[$counter]-&amp;gt;user = $data;&lt;br /&gt;
  // $counter++;&lt;br /&gt;
  break;&lt;br /&gt;
  case $xml_pass_key:&lt;br /&gt;
  &lt;br /&gt;
  $story_array[$counter]-&amp;gt;pass = $data;&lt;br /&gt;
  // $counter++;&lt;br /&gt;
  break;&lt;br /&gt;
  case $xml_name_key:&lt;br /&gt;
  &lt;br /&gt;
  $story_array[$counter]-&amp;gt;name = $data;&lt;br /&gt;
  $counter++;&lt;br /&gt;
  break;&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
  }&lt;br /&gt;
$xml_parser = xml_parser_create();&lt;br /&gt;
xml_set_element_handler($xml_parser, &amp;quot;startTag&amp;quot;, &amp;quot;endTag&amp;quot;);&lt;br /&gt;
xml_set_character_data_handler($xml_parser, &amp;quot;contents&amp;quot;);&lt;br /&gt;
$fp = fopen($xml_file, &amp;quot;r&amp;quot;) or die(&amp;quot;Could not open file&amp;quot;);&lt;br /&gt;
$data = fread($fp, filesize($xml_file)) or die(&amp;quot;Could not read file&amp;quot;);&lt;br /&gt;
if(!(xml_parse($xml_parser, $data, feof($fp)))){&lt;br /&gt;
  die(&amp;quot;Error on line &amp;quot; . xml_get_current_line_number($xml_parser));&lt;br /&gt;
  }&lt;br /&gt;
xml_parser_free($xml_parser);&lt;br /&gt;
fclose($fp);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
  &amp;lt;title&amp;gt;Filezilla Parser&amp;lt;/title&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
  &amp;lt;body bgcolor=&amp;quot;#FFFFFF&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;table width=&amp;quot;1001&amp;quot; border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
  &amp;lt;td width=&amp;quot;47&amp;quot;&amp;gt;&amp;lt;strong&amp;gt;NO&amp;lt;/strong&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td width=&amp;quot;185&amp;quot;&amp;gt;&amp;lt;strong&amp;gt;Name&amp;lt;/strong&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td width=&amp;quot;229&amp;quot;&amp;gt;&amp;lt;strong&amp;gt;Host&amp;lt;/strong&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td width=&amp;quot;221&amp;quot;&amp;gt;&amp;lt;strong&amp;gt;User Name&amp;lt;/strong&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td width=&amp;quot;125&amp;quot;&amp;gt;&amp;lt;strong&amp;gt;Password&amp;lt;/strong&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td width=&amp;quot;154&amp;quot;&amp;gt;&amp;lt;strong&amp;gt;Port&amp;lt;/strong&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;?php&lt;br /&gt;
  for($x=0;$x&amp;lt;count($story_array);$x++){ &lt;br /&gt;
  ?&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
  &amp;lt;td height=&amp;quot;38&amp;quot;&amp;gt;&amp;lt;?=$x++?&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;&amp;lt;?=$story_array[$x]-&amp;gt;name?&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;&amp;lt;?=$story_array[$x]-&amp;gt;host?&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;&amp;lt;?=$story_array[$x]-&amp;gt;user?&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;&amp;lt;?=$story_array[$x]-&amp;gt;pass?&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;&amp;lt;?=$story_array[$x]-&amp;gt;port?&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;?php&lt;br /&gt;
  }&lt;br /&gt;
  ?&amp;gt;&lt;br /&gt;
  &amp;lt;/table&amp;gt; &lt;br /&gt;
 &amp;lt;/body&amp;gt;&lt;br /&gt;
  &amp;lt;/html&amp;gt; &lt;br /&gt;
 &lt;/div&gt;  &lt;br /&gt;
 It will list the FTP host ,FTP username , FTP password and port etc.</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/5060090272502005311/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2010/08/php-parser-to-extract-filezilla-ftp.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/5060090272502005311'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/5060090272502005311'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2010/08/php-parser-to-extract-filezilla-ftp.html' title='PHP Parser to extract Filezilla FTP details'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5500905858342488116.post-7274598933041919584</id><published>2010-06-12T04:26:00.000-07:00</published><updated>2010-11-22T04:26:50.703-08:00</updated><title type='text'>Find out the page loading time using php</title><content type='html'>If you need to know how long your site takes to load, we can use php script. Using the php microtime() we can find the loading time of a webpage. If the webpage loading time is high we can check the page using this code that where it takes too long time to load.&lt;br /&gt;
&lt;br /&gt;
insert the following code at the top of the PHP page&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&amp;lt;?php&lt;br /&gt;
$starttime = microtime();&lt;br /&gt;
$startarray = explode(&quot; &quot;, $starttime);&lt;br /&gt;
$starttime = $startarray[1] + $startarray[0];&lt;br /&gt;
?&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;
also put the following code at the bottom of the page&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&amp;lt;?php&lt;br /&gt;
$endtime = microtime();&lt;br /&gt;
$endarray = explode(&quot; &quot;, $endtime);&lt;br /&gt;
$endtime = $endarray[1] + $endarray[0];&lt;br /&gt;
$totaltime = $endtime - $starttime;&lt;br /&gt;
$totaltime = round($totaltime,10);&lt;br /&gt;
echo &quot;Time To Load: &quot;.$totaltime;&lt;br /&gt;
?&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;
Now when you access your webpage it will show the time taken to load.&lt;br /&gt;
&lt;br /&gt;
For example :&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Time To Load: 0.015601 &lt;/b&gt;</content><link rel='replies' type='application/atom+xml' href='http://cooldecoder.blogspot.com/feeds/7274598933041919584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cooldecoder.blogspot.com/2010/11/find-out-page-loading-time-using-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/7274598933041919584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5500905858342488116/posts/default/7274598933041919584'/><link rel='alternate' type='text/html' href='http://cooldecoder.blogspot.com/2010/11/find-out-page-loading-time-using-php.html' title='Find out the page loading time using php'/><author><name>cooldecoder</name><uri>http://www.blogger.com/profile/01343949164886693383</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>