<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>aaJ TECH LOG</title>
	<atom:link href="http://blog.aajit.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.aajit.com</link>
	<description>Md.Ashraful Abedein</description>
	<lastBuildDate>Sat, 22 Oct 2011 09:27:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Send json in HTTP POST request by CURL php</title>
		<link>http://blog.aajit.com/send-json-in-http-post-request-by-curl-php/</link>
		<comments>http://blog.aajit.com/send-json-in-http-post-request-by-curl-php/#comments</comments>
		<pubDate>Sat, 22 Oct 2011 09:25:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Curl]]></category>

		<guid isPermaLink="false">http://blog.aajit.com/?p=213</guid>
		<description><![CDATA[A simple post operation by php curl. And send some json data.]]></description>
			<content:encoded><![CDATA[<p>A simple post operation by php curl. And send some json data.</p>
<pre class="brush: php; title: ; notranslate">
//extract data from the post
extract($_POST);

//set POST variables
$url = 'http://aajit.com/apipath';
$jsodata='{&quot;to&quot;:&quot;foo&quot;, &quot;msg&quot;:&quot;bar&quot;, &quot;token&quot;:&quot;blah&quot;}';
$fields_string =&quot;aajgw=&quot;.$jsodata;

//open connection
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, 1); // 1 for number of params (aajgw)
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);

//execute post
$result = curl_exec($ch);
echo $result;

//close connection
curl_close($ch);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.aajit.com/send-json-in-http-post-request-by-curl-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pass data from controller to view in magento</title>
		<link>http://blog.aajit.com/pass-data-from-controller-to-view-in-magento/</link>
		<comments>http://blog.aajit.com/pass-data-from-controller-to-view-in-magento/#comments</comments>
		<pubDate>Wed, 31 Aug 2011 06:03:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[magento tips]]></category>

		<guid isPermaLink="false">http://blog.aajit.com/?p=164</guid>
		<description><![CDATA[It&#8217;s may be very easy for Zend framework user But, I sow some magento developer fighting to pass data from controller to view. To pass data from controller to view in magento you have to create a empty model(if your mod don&#8217;t have a varient object model) which extends to varient object. Magento use magic [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s may be very easy for Zend framework user But, I sow some magento developer fighting to pass data from controller to view.<br />
To pass data from controller to view in magento you have to create a empty model(if your mod don&#8217;t have a varient object model) which extends to varient object. Magento use magic getter magic setter so you can pass value by setAnyname() and getAnyname() thus functions will be auto defines by Zend like many other framework do. <img src='http://blog.aajit.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Model file:</p>
<pre class="brush: php; title: ; notranslate">
Packname_Modulename_Model_Viewinfo extends Varien_Object{

}
</pre>
<p>Controller function:</p>
<pre class="brush: php; title: ; notranslate">
public function indexAction()
{
  $bla = Mage::getSingleton('Modulename/viewinfo');
  $bla-&gt;setMsg(&quot;Thank You for your visit!&quot;);
  $this-&gt;loadLayout();
  $this-&gt;renderLayout();
}
</pre>
<p>Now in your View .phtml file add:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php $blas = Mage::getSingleton('Modulename/viewinfo'); ?&gt;
&lt;?php echo $blas-&gt;getMsg(); ?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.aajit.com/pass-data-from-controller-to-view-in-magento/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nobody beat us Fry us and eat us</title>
		<link>http://blog.aajit.com/nobody-beat-us-fry-us-and-eat-us/</link>
		<comments>http://blog.aajit.com/nobody-beat-us-fry-us-and-eat-us/#comments</comments>
		<pubDate>Mon, 08 Aug 2011 17:18:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.aajit.com/?p=199</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><iframe width="425" height="349" src="http://www.youtube.com/embed/C8OBlq_svBY" frameborder="0" allowfullscreen></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.aajit.com/nobody-beat-us-fry-us-and-eat-us/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Want MySQL FullText Search with InnDB Huh?</title>
		<link>http://blog.aajit.com/want-mysql-fulltext-search-with-inndb-huh/</link>
		<comments>http://blog.aajit.com/want-mysql-fulltext-search-with-inndb-huh/#comments</comments>
		<pubDate>Mon, 04 Jul 2011 09:21:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[FullText InnDB]]></category>

		<guid isPermaLink="false">http://blog.aajit.com/?p=193</guid>
		<description><![CDATA[MySQL FullText indexing is only available if database table type MyISAM. But, MyISAM table type does not support Foreign keys. InnoDB table type support Foreign keys but does not support FullText. So I have to use a trick to implement fulltext search for a InnoDB type table. I have created a temporary MyISAM table which [...]]]></description>
			<content:encoded><![CDATA[<p>MySQL FullText indexing is only available if database table type MyISAM. But, MyISAM table type does not support Foreign keys. InnoDB table type support Foreign keys but does not support FullText. So I have to use a trick to implement fulltext search for a InnoDB type table. I have created a temporary MyISAM table which is identical to my InnoDB table and deleted that table after search complete. check this out&#8230;&#8230;</p>
<p>Provide the search term and limit for search result in function&#8217;s parameter.</p>
<pre class="brush: php; title: ; notranslate">&lt;?php

function fulltxt_search($q,$lim1,$lim2){ 

$terms =trim(stripslashes(strip_tags($q)));
$rhtml=&quot;&quot;;
if(empty($terms)){

   $rhtml.= &quot;\n&quot;.'&lt;p&gt;No search term entered.&lt;/p&gt;';

}else{

   // SQL injection prevention (double quote mark is allowed here but should probably be disallowed)

   $terms = strtr($terms, ',/\*&amp;()$%^@~`?;', '               ');

   $terms = trim($terms);

   $terms = str_replace('#180', '', $terms);

   $rhtml.= &quot;\n&quot;.'&lt;p&gt;Searching for &lt;i&gt;'.htmlspecialchars($terms).'&lt;/i&gt;... &lt;/p&gt;';

   $key = 'text_index';

   // Beware of the re-definition of $s in this query.

   $terms = html_entity_decode($terms, ENT_QUOTES);

	mysql_query('CREATE TEMPORARY TABLE `tbl_mirror` (FULLTEXT INDEX (`info`)) Engine=MyISAM SELECT * FROM `values`');

   if(!($res = @mysql_query('SELECT * FROM `tbl_mirror` WHERE MATCH(`info`) AGAINST (&quot;'.$terms.'&quot;) LIMIT '.$lim1.', '.$lim2.';')or die(mysql_error()))){

	  mysql_query('DROP TEMPORARY TABLE tbl_mirror;')or die(mysql_error());
      echo &quot;\n&quot;.'&lt;p&gt;No match for: &lt;i class=&quot;red&quot;&gt;'.$terms.'&lt;/i&gt;&lt;/p&gt;';

   }else{

	mysql_query('DROP TEMPORARY TABLE tbl_mirror;')or die(mysql_error());

      if(@mysql_num_rows($res) == 0){

        $rhtml.=&quot;\n&quot;.'&lt;p&gt;The search engine cannot find the page you are looking for.&lt;/p&gt;';

        $rhtml.=&quot;\n&quot;.'&lt;p&gt;This could be because it could not find any pages containing &lt;i&gt;'.$terms.'&lt;/i&gt;';

        $rhtml.=&quot;\n&quot;.'&lt;p&gt;Alternatively, it might have found too many pages, and could not decide which one you wanted.&lt;/p&gt;';

      }else{

         $i = 0;

         while($row = mysql_fetch_array($res)){

            $s = substr(stristr(strip_tags($row['info']), $terms), 0, 120);
            $i++;
	    $out[]=$row;
            $rhtml.=&quot;\n&quot;.'&lt;p&gt;'.$i.'.) &lt;a href=&quot;results.php?rez_id='.$row['f_id'].'&quot;&gt;'.htmlentities($row['info']).' - '.$row['f_id'].'&lt;/a&gt;&lt;br /&gt;... '.$s.'...'.$row['id'].'/'.$row['e_id'].'...&lt;/p&gt;';

         }

      }

   }

}

return $rhtml;
}
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.aajit.com/want-mysql-fulltext-search-with-inndb-huh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Export/Backup MySQL Database like phpMyAdmin</title>
		<link>http://blog.aajit.com/exportbackup-mysql-database-like-phpmyadmin/</link>
		<comments>http://blog.aajit.com/exportbackup-mysql-database-like-phpmyadmin/#comments</comments>
		<pubDate>Mon, 04 Jul 2011 08:59:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[php MySQL Export]]></category>

		<guid isPermaLink="false">http://blog.aajit.com/?p=189</guid>
		<description><![CDATA[Call the function with database name and a path to save backup( leave blank for current dir)]]></description>
			<content:encoded><![CDATA[<p>Call the function with database name and a path to save backup( leave blank for current dir)</p>
<pre class="brush: php; title: ; notranslate">&lt;?php
function db_bkf($dbname, $path=''){

ini_set('display_errors',1);
error_reporting(E_ALL);
echo 'Backuping database....';
$drop=0;

mysql_connect('localhost', 'root', '');

mysql_select_db(&quot;logs&quot;);

$hostname='localhost'; $username='root'; $password='';

$backupFile = $path.$dbname . date(&quot;Y-m-d-H-i-s&quot;) . '.sql';

$tab_status = mysql_query(&quot;SHOW TABLE STATUS&quot;);

while($all = mysql_fetch_assoc($tab_status)):

    $tbl_stat[$all['Name']] = $all['Auto_increment'];

endwhile;

$backup='';

$tables = mysql_query(&quot;SHOW TABLES FROM $dbname&quot;);

echo ($tables==&quot;&quot;)?&quot;No db table found !&quot;:count($tables).&quot; Tables&quot;;

while($tabs = mysql_fetch_row($tables)):

$droptbl=(($drop==1)?&quot;DROP IF EXISTS TABLE `&quot;.$tabs[0].&quot;`;&quot;:&quot;&quot;);

    $backup .= &quot;--\n--Table structure for `$tabs[0]`\n--\n\n&quot;.$droptbl.&quot;\nCREATE TABLE IF NOT EXISTS `$tabs[0]` (&quot;;

    $res = mysql_query(&quot;SHOW CREATE TABLE $tabs[0]&quot;);

    while($all = mysql_fetch_assoc($res)):

        $str = str_replace(&quot;CREATE TABLE `$tabs[0]` (&quot;, &quot;&quot;, $all['Create Table']);

        $str = str_replace(&quot;,&quot;, &quot;,&quot;, $str);

        $str2 = str_replace(&quot;`) ) TYPE=MyISAM &quot;, &quot;`)\n ) TYPE=MyISAM &quot;, $str);

        $backup .= $str2.&quot; AUTO_INCREMENT=&quot;.$tbl_stat[$tabs[0]].&quot;;\n\n&quot;;

    endwhile;

    $backup .= &quot;--\n--Data to be executed for table `$tabs[0]`\n--\n\n&quot;;

    $data = mysql_query(&quot;SELECT * FROM $tabs[0]&quot;);

    while($dt = mysql_fetch_row($data)):

        $backup .= &quot;INSERT INTO `$tabs[0]` VALUES('$dt[0]'&quot;;

        for($i=1; $i&lt;sizeof($dt); $i++):

            $backup .= &quot;, '$dt[$i]'&quot;;

        endfor;

        $backup .= &quot;);\n&quot;;

    endwhile;

    $backup .= &quot;\n-- --------------------------------------------------------\n\n&quot;;

endwhile;

$fh=fopen($backupFile,'w') or die(&quot;Backup not done! file error&quot;);
fwrite($fh, $backup);
fclose($fh);
echo &quot;&lt;br /&gt;Backup Complete !&quot;; 

}
?&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.aajit.com/exportbackup-mysql-database-like-phpmyadmin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

