<?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>Programming Ideas, Logics, Tips and Tricks &#187; general</title>
	<atom:link href="http://www.sajithmr.me/category/general/feed" rel="self" type="application/rss+xml" />
	<link>http://www.sajithmr.me</link>
	<description></description>
	<lastBuildDate>Mon, 23 Jan 2012 15:44:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Facebook changes App profile page</title>
		<link>http://www.sajithmr.me/facebook-changes-app-profile-page</link>
		<comments>http://www.sajithmr.me/facebook-changes-app-profile-page#comments</comments>
		<pubDate>Mon, 23 Jan 2012 15:44:09 +0000</pubDate>
		<dc:creator>Mr Me</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[webworld]]></category>
		<category><![CDATA[facebook]]></category>

		<guid isPermaLink="false">http://www.sajithmr.me/?p=1085</guid>
		<description><![CDATA[From February 2012 onwards, Facebook stops App profile pages. But you can still move all your page likes and users to new page (till Feb). The new Facebook app creation flow is really confusing. For developers, to add a app as a tab to another page, you  need to user the following URL: https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&#38;next=YOUR_URL next [...]]]></description>
			<content:encoded><![CDATA[<p>From February 2012 onwards, Facebook stops App profile pages. But you can still move all your page likes and users to new page (till Feb).</p>
<p>The new Facebook app creation flow is really confusing.</p>
<p>For developers, to add a app as a tab to another page, you  need to user the following URL:</p>
<p><a href="https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&amp;next=YOUR_URL">https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&amp;next=YOUR_URL</a></p>
<p>next parameter should be your canvas page url.</p>
<p>Here you can see an option to add this app to your page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sajithmr.me/facebook-changes-app-profile-page/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jRecorder 1.1 with Preview option is released</title>
		<link>http://www.sajithmr.me/jrecorder1-1-with-preview-option-is-released</link>
		<comments>http://www.sajithmr.me/jrecorder1-1-with-preview-option-is-released#comments</comments>
		<pubDate>Wed, 14 Dec 2011 17:39:44 +0000</pubDate>
		<dc:creator>Mr Me</dc:creator>
				<category><![CDATA[Downloads]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[general]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php source code]]></category>
		<category><![CDATA[webworld]]></category>

		<guid isPermaLink="false">http://www.sajithmr.me/?p=1071</guid>
		<description><![CDATA[Two months ago, I published a jQuery plugin to record audio from browser (without any Media server) called jRecorder I got many responses and requests to maintain the code with new enhancements and some bug fixes. Based on that, a new version (1.1) is released which has the capability to preview the recorded audio before [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone" src="http://www.sajithmr.me/wp-content/uploads/2011/10/recorder.png" alt="" width="326" height="124" /></p>
<p>Two months ago, I published a jQuery plugin to record audio from browser (without any Media server) called <a title="jRecorder - jQuery Plugin" href="http://www.sajithmr.me/jrecorder-jquery" target="_blank">jRecorder</a></p>
<p>I got many responses and requests to maintain the code with new enhancements and some bug fixes.</p>
<p>Based on that, a new version (<a title="jRecorder with Preview" href="http://www.sajithmr.me/jrecorder/index.html" target="_blank">1.1</a>) is released which has the capability to preview the recorded audio before sending to the server.</p>
<p>See the example implementation and documentation <a title="jRecorder - jQuery Plugin" href="http://www.sajithmr.me/jrecorder/index.html" target="_blank">here</a>.</p>
<p>Also I made this source open and available for anybody to develop at: https://github.com/sythoos/jRecorder/</p>
<p>Thanks</p>
<p>Sajith</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sajithmr.me/jrecorder1-1-with-preview-option-is-released/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Facebook &#8211; Like to see the content</title>
		<link>http://www.sajithmr.me/facebook-like-to-see-the-content</link>
		<comments>http://www.sajithmr.me/facebook-like-to-see-the-content#comments</comments>
		<pubDate>Wed, 09 Nov 2011 21:29:20 +0000</pubDate>
		<dc:creator>Mr Me</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[php source code]]></category>

		<guid isPermaLink="false">http://www.sajithmr.me/?p=1059</guid>
		<description><![CDATA[Sometime in Facebook Pages, you can see the message / banner, we have offers for you, like us to see. Or Like us to unlock the content etc. These all are for getting more likes in their Facebook page and indeed, it is a very nice idea to spread your updates among many of your [...]]]></description>
			<content:encoded><![CDATA[<p>Sometime in Facebook Pages, you can see the message / banner, we have offers for you, like us to see. Or Like us to unlock the content etc. These all are for getting more likes in their Facebook page and indeed, it is a very nice idea to spread your updates among many of your Facebook Fans. Usually people won&#8217;t do the dislike option to revert it back!</p>
<p>The question is how can we do this ?</p>
<p>The trick here is, you need to create a page using iframe as you usually create FB app. In that iframe, you have your custom page fragment hosted somewhere else showing some copies/contents/offer etc.</p>
<p>Each time when Facebook load your url inside the iframe, Facebook do a POST to your domain signed_request as the parameter. The rest of the part you have to handle with your server side scripting.</p>
<p>Here mine is PHP:</p>
<p>&lt;?php</p>
<p>$signed_request = $_REQUEST["signed_request"];<br />
// $_POST also work, but better with $_REQUEST</p>
<p>list($encoded_sig, $payload) = explode(&#8216;.&#8217;, $signed_request, 2);</p>
<p>$data = json_decode(base64_decode(strtr($payload, &#8216;-_&#8217;, &#8216;+/&#8217;)), true);</p>
<p>if (empty($data["page"]["liked"])) {</p>
<p>//write code here to show a non-liked situational contents<br />
echo &#8220;You haven&#8217;t liked us yet&#8221;;</p>
<p>}<br />
else {</p>
<p>//write code here to show contents for already liked people<br />
echo &#8220;Hello Fan, here are your offers.&#8221;;</p>
<p>}<br />
?&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sajithmr.me/facebook-like-to-see-the-content/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Adobe Edge &#8211; HTML5 made easy</title>
		<link>http://www.sajithmr.me/adobe-edge-html5-made-easy</link>
		<comments>http://www.sajithmr.me/adobe-edge-html5-made-easy#comments</comments>
		<pubDate>Wed, 26 Oct 2011 17:15:30 +0000</pubDate>
		<dc:creator>Mr Me</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[webworld]]></category>

		<guid isPermaLink="false">http://www.sajithmr.me/?p=1044</guid>
		<description><![CDATA[I tried new Adobe Edge yesterday, wow it is cool and it took only 10 minutes for me to develop the following animation in HTML 5. You can simply do animation, movements, rotation, resizing, font changes etc as you do in Flash layers . You can also write actions in javascript, if reached here, or [...]]]></description>
			<content:encoded><![CDATA[<p>I tried new Adobe Edge yesterday, wow it is cool and it took only 10 minutes for me to develop the following animation in HTML 5. You can simply do animation, movements, rotation, resizing, font changes etc as you do in Flash layers . You can also write actions in javascript, if reached here, or if click here do this, or do that. It will give your exported html file with all these design in pure HTML5. Please use new Firefox or Safari or Chrome to try this.<br />
<iframe src="http://www.sajithmr.me/html5/" width="700" height="400"></iframe></p>
<p>You can download Adobe Edge Trail Version <a href="http://labs.adobe.com/technologies/edge/" target="_blank">here</a>.</p>
<p>Also see what others did with Adobe Edge here:</p>
<p><a href="http://labs.adobe.com/technologies/edge/resources/" target="_blank">http://labs.adobe.com/technologies/edge/resources/</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sajithmr.me/adobe-edge-html5-made-easy/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mr Me is totally new now</title>
		<link>http://www.sajithmr.me/mr-me-is-tottaly-new-now</link>
		<comments>http://www.sajithmr.me/mr-me-is-tottaly-new-now#comments</comments>
		<pubDate>Fri, 07 Oct 2011 10:28:52 +0000</pubDate>
		<dc:creator>Mr Me</dc:creator>
				<category><![CDATA[general]]></category>

		<guid isPermaLink="false">http://www.sajithmr.me/?p=981</guid>
		<description><![CDATA[This is the 200th article of sajithmr.me So, I thought to write something special and it is regarding the new website. New theme, New WP Version, New Server,  New Logo, Mr Me is totally new &#160;]]></description>
			<content:encoded><![CDATA[<p>This is the 200th article of sajithmr.me</p>
<p>So, I thought to write something special and it is regarding the new website.</p>
<p>New theme, New WP Version, New Server,  New Logo, Mr Me is totally new</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sajithmr.me/mr-me-is-tottaly-new-now/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>QR Code Generator</title>
		<link>http://www.sajithmr.me/qr-code-generator</link>
		<comments>http://www.sajithmr.me/qr-code-generator#comments</comments>
		<pubDate>Sun, 22 May 2011 17:21:06 +0000</pubDate>
		<dc:creator>Mr Me</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.sajithmr.me/?p=952</guid>
		<description><![CDATA[A PHP based tool to generate QR Code for your website URL. http://qrcode-factory.com/ Now a days, the usage of QR code is higher and this is becoming one of the PR generating mechanisms. QR code is another kind of bar code called matrix bar code.  QR stands for Quick Reader (source: WikiPedia) The tool is [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sajithmr.me/wp-content/uploads/2011/05/sajithmr.png"><img class="alignnone size-full wp-image-954" title="sajithmr" src="http://www.sajithmr.me/wp-content/uploads/2011/05/sajithmr.png" alt="" width="239" height="239" /></a></p>
<p>A PHP based tool to generate QR Code for your website URL.</p>
<p><a title="QR Code Generator" href="http://qrcode-factory.com/" target="_self">http://qrcode-factory.com/</a></p>
<p>Now a days, the usage of QR code is higher and this is becoming one of the PR generating mechanisms.</p>
<p>QR code is another kind of bar code called matrix bar code.  QR stands for Quick Reader (source: <a href="http://en.wikipedia.org/wiki/QR_code" target="_blank">WikiPedia</a>)</p>
<p>The tool is created using <a href="http://phpqrcode.sourceforge.net/" target="_blank">PHP QR code library</a>.</p>
<p>Use RedLaser Apps for mobile devices to read QR codes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sajithmr.me/qr-code-generator/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New URL Shortener</title>
		<link>http://www.sajithmr.me/new-url-shortener</link>
		<comments>http://www.sajithmr.me/new-url-shortener#comments</comments>
		<pubDate>Fri, 22 Apr 2011 09:50:44 +0000</pubDate>
		<dc:creator>Mr Me</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[phurl]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[short url]]></category>

		<guid isPermaLink="false">http://www.sajithmr.me/?p=942</guid>
		<description><![CDATA[I recently started a new URL shortener service. If you&#8217;re bored with old short-url services, you can start using this http://zip.ms Here you can set your-own custom alias, than some random string. I used Phurl library to create this website. I have no spam guard added in the site, please be a real human, I [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone" src="http://zip.ms/logo.jpg" alt="" width="240" height="68" /></p>
<p>I recently started a new URL shortener service. If you&#8217;re bored with old short-url services, you can start using this <img src='http://www.sajithmr.me/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<a href="http://zip.ms">http://zip.ms</a></p>
<p>Here you can set your-own custom alias, than some random string.</p>
<p>I used <a href="http://code.google.com/p/phurl/">Phurl</a> library to create this website.</p>
<p>I have no spam guard added in the site, please be a real human, I trust you <img src='http://www.sajithmr.me/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>&#8211; Sajith</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sajithmr.me/new-url-shortener/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Facebook Graph API &#8211; The missing part</title>
		<link>http://www.sajithmr.me/facebook-graph-api-the-missing-part</link>
		<comments>http://www.sajithmr.me/facebook-graph-api-the-missing-part#comments</comments>
		<pubDate>Thu, 15 Jul 2010 08:15:39 +0000</pubDate>
		<dc:creator>Mr Me</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[album]]></category>
		<category><![CDATA[albums]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[empty string]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[graph api]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[missing]]></category>
		<category><![CDATA[permission]]></category>
		<category><![CDATA[photos]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[privacy]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.sajithmr.me/?p=840</guid>
		<description><![CDATA[As you all know recent changes in privacy issues made Facebook to change their basic API and added some security concerns. From my best practise, most of the old applications are safe, but you will be in trouble when you create new application. By default you cannot access user&#8217;s photos, profile pictures , albums etc. [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-841" title="facebook_logo" src="http://www.sajithmr.me/wp-content/uploads/2010/07/facebook_logo.png" alt="facebook_logo" width="400" height="132" /></p>
<p>As you all know recent changes in privacy issues made Facebook to change their basic API and added some security concerns. From my best practise, most of the old applications are safe, but you will be in trouble when you create new application. By default you cannot access user&#8217;s photos, profile pictures , albums etc. If you continue with old REST API, you may face this problem. You will get an empty array or json string when you call <strong>photos.getAlbum</strong>s function.</p>
<p>If you test these functions from Facebook Console Tool:</p>
<p><a href="http://developers.facebook.com/docs/reference/rest/photos.getAlbums" target="_blank">http://developers.facebook.com/docs/reference/rest/photos.getAlbums</a></p>
<p>It returns real value when you select old applications and returns empty string [] if you select your newly created Facebook app.</p>
<p>To get all those support, you need to use new <a href="http://developers.facebook.com/docs/api" target="_blank">Graph API</a></p>
<p>But if you follow the same steps mentioned in that official document, you will still get this empty string problem. Because, in the basic authentication call, there is no permission type is mentioned. You can only see a basic message with Allow or Deny button.</p>
<p>According to that document, as the part of authentication, you need to call this url with your client id and redirect url and it returns an access_token after a #</p>
<pre style="margin-top: 18px; margin-right: 18px; margin-bottom: 18px; margin-left: 39px; padding-top: 7px; padding-right: 0px; padding-bottom: 7px; padding-left: 10px; outline-width: 0px; outline-style: initial; outline-color: initial; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 3px; border-style: solid; border-color: #d8dfea; line-height: 18px; font-family: monospace; color: #006000; font-size: 13px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f2f2f2; overflow-x: auto; overflow-y: auto; background-position: initial initial; background-repeat: initial initial;">https://graph.facebook.com/oauth/authorize?
    client_id=...&amp;
    redirect_uri=http://www.example.com/oauth_redirect</pre>
<p>You need to use this access_token to request all other functions, eg:</p>
<pre style="margin-top: 18px; margin-right: 18px; margin-bottom: 18px; margin-left: 39px; padding-top: 7px; padding-right: 0px; padding-bottom: 7px; padding-left: 10px; outline-width: 0px; outline-style: initial; outline-color: initial; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 3px; border-style: solid; border-color: #d8dfea; line-height: 18px; font-family: monospace; color: #006000; font-size: 13px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f2f2f2; overflow-x: auto; overflow-y: auto; background-position: initial initial; background-repeat: initial initial;">https://graph.facebook.com/me?access_token=...</pre>
<p>This call will work for most of the requests except photos or albums. So the mistake in these calls are the permission.</p>
<p><strong><span style="color: #ff6600;">Here is the correction:</span></strong></p>
<pre style="font: normal normal normal 12px/18px Consolas, Monaco, 'Courier New', Courier, monospace; margin-top: 18px; margin-right: 18px; margin-bottom: 18px; margin-left: 39px; padding-top: 7px; padding-right: 0px; padding-bottom: 7px; padding-left: 10px; outline-width: 0px; outline-style: initial; outline-color: initial; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 3px; line-height: 18px; font-family: monospace; color: #006000; font-size: 13px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f2f2f2; overflow-x: auto; overflow-y: auto; border-color: #d8dfea; border-style: solid;">https://graph.facebook.com/oauth/authorize?
    client_id=...&amp;
    redirect_uri=http://www.example.com/oauth_redirect&amp;perms=publish_stream,user_photos</pre>
<p>Here we pass perms parameter to set different permission and if you use the access_token after this request , you can access user photos and albums. You can see another permission popup with album and photo access.</p>
<p><a href="http://developers.facebook.com/docs/authentication/permissions" target="_blank">Here</a> is the list of such extended permissions in Facebook.</p>
<p>This is the problem when you use new Javascript SDK for graph API, or when you try to integrate these API in PHP or PERL or any other Server side scripting language from the scratch.</p>
<p>If you use new <a href="http://github.com/facebook/php-sdk/" target="_blank">Facebook PHP Graph SDK </a>, you cannot get these problems, but there is still another hidden problem if you continue testing code by the example provided by them.</p>
<p>It is my next POST . See you at there</p>
<p>Thanks</p>
<p>Sajith</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sajithmr.me/facebook-graph-api-the-missing-part/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Facebook Graph API for PHP</title>
		<link>http://www.sajithmr.me/facebook-graph-api-for-php</link>
		<comments>http://www.sajithmr.me/facebook-graph-api-for-php#comments</comments>
		<pubDate>Thu, 15 Jul 2010 05:29:09 +0000</pubDate>
		<dc:creator>Mr Me</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[apt-get]]></category>
		<category><![CDATA[blank page]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[install curl]]></category>
		<category><![CDATA[install json]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[pecl]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sdk]]></category>
		<category><![CDATA[solution]]></category>

		<guid isPermaLink="false">http://www.sajithmr.me/?p=845</guid>
		<description><![CDATA[Like the old REST API, you don&#8217;t need to add 2-3 files for Facebook PHP SDK. The new graph api comes in a single file which is located at http://github.com/facebook/php-sdk/ Copy the facebook.php file in to your webroot and include this file in your php code. require_once(&#8216;facebook.php&#8217;); To work fully functional, you need CURL and [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-848" title="php" src="http://www.sajithmr.me/wp-content/uploads/2010/07/php.png" alt="php" width="346" height="226" /></p>
<p>Like the old REST API, you don&#8217;t need to add 2-3 files for Facebook PHP SDK. The new graph api comes in a single file which is located at <a href="http://github.com/facebook/php-sdk/" target="_blank">http://github.com/facebook/php-sdk/</a></p>
<p>Copy the facebook.php file in to your webroot and include this file in your php code.</p>
<p>require_once(&#8216;facebook.php&#8217;);</p>
<p>To work fully functional, you need CURL and JSON installed in your server. To check this use phpinfo() function.</p>
<p>To make sure, these missing is the main problem, add  <span style="color: #00ccff;"><span style="color: #3366ff;">exit(&#8216;Curl error&#8217;)</span>;</span> just above the line   <span style="color: #3366ff;">throw new Exception(&#8216;Facebook needs the CURL PHP extension.&#8217;); <span style="color: #000000;">in facebook.php file.</span></span></p>
<p><span style="color: #3366ff;"><span style="color: #000000;">Same for JSON.</span></span></p>
<p>The Linux way of installing CURL is :</p>
<p><strong>sudo apt-get install curl libcurl3 libcurl3-dev php5-curl</strong></p>
<p>To install JSON in your linux machine, follow <a href="http://slaptijack.com/system-administration/lets-install-json-for-php-5/" target="_blank">these</a> steps:</p>
<ol>
<li><strong>pecl install json</strong></li>
<li>Add json.ini file in /etc/php.d/</li>
<li>edit json.ini (in VI) and add this line: xtension=json.so</li>
<li>Save the file and restart appache (/etc/init.d/httpd restart)  <em>or apache2 restart depends on your linux OS</em></li>
</ol>
<p>See the example.php file in php-sdk from Github, if you call getSession function, you only get a NULL string if you are not logged in proper way. So I recommend to redirect into login page if there is no session available.</p>
<p>Here is the change:</p>
<p>if (! $facebook-&gt;getSession()) {</p>
<p>header(&#8216;Location: &#8216;.$facebook-&gt;getLoginUrl());</p>
<p>}</p>
<p>Then try the rest of the part as per example.php , it will work</p>
<p>Good Luck</p>
<p>Sajith</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sajithmr.me/facebook-graph-api-for-php/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Multi-language support with PHP</title>
		<link>http://www.sajithmr.me/multi-language-support-with-php</link>
		<comments>http://www.sajithmr.me/multi-language-support-with-php#comments</comments>
		<pubDate>Sun, 06 Jun 2010 10:28:08 +0000</pubDate>
		<dc:creator>Mr Me</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[arab]]></category>
		<category><![CDATA[engilsh]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[french]]></category>
		<category><![CDATA[hindi]]></category>
		<category><![CDATA[multi]]></category>
		<category><![CDATA[multi-language]]></category>
		<category><![CDATA[multi-langugage support]]></category>
		<category><![CDATA[support]]></category>

		<guid isPermaLink="false">http://www.sajithmr.me/?p=725</guid>
		<description><![CDATA[If you aim to create a multi-language  website using PHP + Mysql , remember the following tips. You can use mysql database for this purpose rather than using separate language files as usual content management system does. You can create a table with following structure for this purpose.Table: muli-lang string_id: page_id: en: arb: fr: Here [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-medium wp-image-728" title="multi-language-interface" src="http://www.sajithmr.me/wp-content/uploads/2010/06/multi-language-interface-300x197.jpg" alt="multi-language-interface" width="300" height="197" /></p>
<p>If you aim to create a multi-language  website using PHP + Mysql , remember the following tips.</p>
<ul>
<li>You can use mysql database for this purpose rather than using separate language files as usual content management system does.</li>
<li>You can create a table with following structure for this purpose.Table: muli-lang<br />
string_id:<br />
page_id:<br />
en:<br />
arb:<br />
fr:</li>
<li> Here string_id is the code for getting content  eg: welcome_message<br />
page_id is for saving in which page the content belongs to.  eg: home_page, login_page etc<br />
In field en, you have to enter the message in english,eg: Welcome to my website<br />
In arb field you can enter the corresponding translation in arab. eg: مرحبا بكم في موقعي</li>
<li>If you need to add more languages, it is just adding one more column to this table and put all translated values.</li>
<li>Write a class or functions in PHP to retrieve all the informations.<br />
eg: function get(language_id, page_id) returns corresponding message</li>
<li>Use session to save lang value. For example if you switch to french, set a variable lang= fr and use this variable to decide which column is to access from multi-lang table.eg: the sql will be , SELECT $lang FROM multi-lang WHERE string_id = &#8216;welcome_message&#8217;</li>
<li>For some string fragment like about_us, contact_us etc, it has global scope; then leave page_id as blank</li>
<li>To avoid multiple calling of functions to get translation, write a common function to get all translation for a particular page_id as array, and use this array all through the page. Thus you can avoid mysql query multiple times.<br />
eg: function get_all($page_id) returns array, say $Translate of all strings replacement. $Translate['login_message'], $Translate['login_error']</li>
<li>Additional things to remember:</li>
<li>Use this meta tab in html header<br />
<span style="color: #993300;">&lt;</span><em><span style="color: #993300;">meta</span></em><span style="color: #993300;"> http-equiv=&#8221;Content-Type&#8221; content=&#8221;text /</span><em><span style="color: #993300;">html</span></em><span style="color: #993300;">; charset=</span><em><span style="color: #993300;">UTF-8</span></em><span style="color: #993300;">&#8221; /&gt;</span><br />
to show all languages</li>
<li>Create my_sql table in UTF-8 format</li>
<li>Execute the following query before executing any retrieval queries. Otherwise you may get ????? for language like Arabic, Hindi, Chinese etc.<br />
<span style="color: #333399;">mysql_query(&#8220;SET CHARACTER SET &#8216;utf8&#8242;&#8221;, $link);</span></li>
</ul>
<p>I hope these information may help you when you develop a multi-langauge support website</p>
<p>Thank you<br />
Sajith</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sajithmr.me/multi-language-support-with-php/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

