<?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>Usman.it</title>
	<atom:link href="http://usman.it/feed/" rel="self" type="application/rss+xml" />
	<link>http://usman.it</link>
	<description>Freelance web app developer, crazy tech lover, endless learner</description>
	<lastBuildDate>Sun, 01 Apr 2012 17:50:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Goals of First Quarter of 2012</title>
		<link>http://usman.it/goals-quarter-2012/</link>
		<comments>http://usman.it/goals-quarter-2012/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 11:24:30 +0000</pubDate>
		<dc:creator>Muahammad Usman</dc:creator>
				<category><![CDATA[My Life]]></category>
		<category><![CDATA[goals]]></category>

		<guid isPermaLink="false">http://usman.it/?p=170</guid>
		<description><![CDATA[Goals of last quarter was a 100% success, alhamdulillah (praise be to God). Now goals of frist quarter of 2012: Inshallah (God willing) I will &#8230; Build strong hands on Java with Android. Write 3 blog posts on tech stuff. &#8230; <a href="http://usman.it/goals-quarter-2012/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://usman.it/goals-of-last-quarter-of-2011/">Goals of last quarter</a> was a 100% success, alhamdulillah (praise be to God).</p>
<p>Now goals of frist quarter of 2012:<br />
Inshallah (God willing) I will &#8230;</p>
<ol>
<li>Build strong hands on Java with Android.</li>
<li>Write 3 blog posts on tech stuff.</li>
<li>Reach 2700 reputation level at Stack Overflow <a href="http://stackoverflow.com/users/656489/usman" rel="nofollow nofollow" target="_blank">http://stackoverflow.com/<wbr>users/656489/usman</wbr></a> .</li>
<li>Contribute on some selected projects on Github.</li>
<li>Finish the book jQuery Novice to Ninja.</li>
<li>Have a revitalizing tour.</li>
<li>Read 2 Islamic Books.</li>
</ol>
<p>(2 entries hidden)</p>
]]></content:encoded>
			<wfw:commentRss>http://usman.it/goals-quarter-2012/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Bangla Font for Android</title>
		<link>http://usman.it/bangla-font-android/</link>
		<comments>http://usman.it/bangla-font-android/#comments</comments>
		<pubDate>Sun, 18 Dec 2011 13:33:45 +0000</pubDate>
		<dc:creator>Muahammad Usman</dc:creator>
				<category><![CDATA[Resource]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[bangla]]></category>

		<guid isPermaLink="false">http://usman.it/?p=146</guid>
		<description><![CDATA[Overview: I have received too many requests for a Bangla Font for Android. Unfortunately Android is not so matured in handling Unicode and Complex Script and there was no way of installing new font without rooting the device, but Samsung &#8230; <a href="http://usman.it/bangla-font-android/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><u><strong>Overview:</strong></u></p>
<p>I have received too many requests for a Bangla Font for Android. Unfortunately Android is not so matured in handling Unicode and Complex Script and there was no way of installing new font without rooting the device, but Samsung has come up with a great way allowing installing fonts. So I have created this Bangla Font which will work on <strong>Samsung Devices</strong> or other devices with custom font support, so now you can see Bangla in Applications, but don&#8217;t get too excited,<strong> the complex script (Jukto Borno and so) may not appear correctly in some devices</strong>, also some carriers may create some problems. I have tried a lot to solve the issue but I couldn&#8217;t, well I said Android is not that matured in that way. So this Font comes without any warranty, so I haven&#8217;t published it in the Android Market.<br />
There is a proverb in Bangla:<br />
<strong>নাই মামার চেয়ে কানা মামা ভাল </strong></p>
<p>So please try to be happy at least now you can see Bangla in your apps without rooting the device <img src='http://usman.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><u><strong>Installation:</strong></u></p>
<ul>
<li>First of all don&#8217;t use Opera Mini browser for any of the step below, use Android&#8217;s default browser.</li>
<li>Go to your device&#8217;s Settings > Application and make sure &#8220;Unknown sources&#8221; is checked. If you see any warning click OK.</li>
<li>Download the Font file to your Phone or Tablet from this link <a href="http://j.mp/banglaf" title="Download">http://j.mp/banglaf</a> .<br />
Either go to browser and type this link http://j.mp/banglaf<br />
Or Scan the QR Code below with your Barcode Scanner app and go to the link (by tapping &#8220;Open browser&#8221; button) <br/><br />
<img src="http://qrcode.kaywa.com/img.php?s=8&#038;d=http%3A%2F%2Fj.mp%2Fbanglaf" alt="qrcode"  /> <br/><br />
Or Download the file in your PC and transfer to Phone <a href="http://j.mp/banglaf" title="Download font on your PC">http://j.mp/banglaf</a>
        </li>
<li>Open the downloaded file by tapping, in your device and Install</li>
<li>Go to Settings > Display > Font style and Select BanglaFont, tap OK then tap &#8220;Restart now&#8221;.</li>
</ul>
<p>That&#8217;s it. Now start your device&#8217;s browser and visit the link http://j.mp/bangladroid if you see the idiom (nai mama) above then it&#8217;s okay.</p>
<p>If you like this please click the Facebook Like below or share this with your friends. You can also revert to the old font if you wish.</p>
]]></content:encoded>
			<wfw:commentRss>http://usman.it/bangla-font-android/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Phonetic Bangla &#8211; Write Painless Bangla Across the Web</title>
		<link>http://usman.it/phonetic-bangla-write-painless-bangla-across-web/</link>
		<comments>http://usman.it/phonetic-bangla-write-painless-bangla-across-web/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 18:53:00 +0000</pubDate>
		<dc:creator>Muahammad Usman</dc:creator>
				<category><![CDATA[Project]]></category>
		<category><![CDATA[Resource]]></category>
		<category><![CDATA[bangla]]></category>
		<category><![CDATA[chrome extension]]></category>

		<guid isPermaLink="false">http://usman.it/?p=130</guid>
		<description><![CDATA[Now you can Write cross platform Phonetic Bangla accross the web. No matter what the Operating System is, you can write phonetic Bangla in Facebook, Google, Yahoo or any other website with Google Chrome. You do NOT need any other &#8230; <a href="http://usman.it/phonetic-bangla-write-painless-bangla-across-web/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Now you can Write cross platform Phonetic Bangla accross the web. No matter what the Operating System is, you can write phonetic Bangla in Facebook, Google, Yahoo or any other website with Google Chrome. You do NOT need any other software to be installed in order to use this. Rich text editors are not working with Bangla yet, we are working on it.</p>
<p><a href="https://chrome.google.com/webstore/detail/phhfplkjmdnjlencafghobppiglhhfcf" title="Download" target="_blank"><strong>Download the Extension from Chrome Web Store.</strong></a></p>
<p><a target="_blank" href="https://chrome.google.com/webstore/detail/phhfplkjmdnjlencafghobppiglhhfcf"><img src="http://usman.it/wp-content/uploads/2011/11/phonetic-bangla-promo.png" alt="Download from Chrome Web Store" title="Download from Chrome Web Store" width="440" height="280" class="aligncenter size-full wp-image-131" /></a></p>
<p>Press CTRL + Q to switch between Bangla and English.</p>
<p>Just type and press Space and or Enter and it will be converted to Bangla.</p>
<p>Its powered by Avro, thank you Avro Team.</p>
<p>Enjoy <img src='http://usman.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://usman.it/phonetic-bangla-write-painless-bangla-across-web/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Camouflage &#8211;  A Premium Quality WordPress Theme for FREE (beta)</title>
		<link>http://usman.it/camouflage-premium-quality-wordpress-theme-free/</link>
		<comments>http://usman.it/camouflage-premium-quality-wordpress-theme-free/#comments</comments>
		<pubDate>Sun, 30 Oct 2011 19:07:23 +0000</pubDate>
		<dc:creator>Muahammad Usman</dc:creator>
				<category><![CDATA[Project]]></category>
		<category><![CDATA[Resource]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://usman.it/?p=97</guid>
		<description><![CDATA[This time I have a Gift for you. Its Stunning, Multiple Skin WordPress Theme allowing you full customization. Here are some of the features to rock you: Great Eye-catching Look. Multiple Skins &#8211; which will change the look of your &#8230; <a href="http://usman.it/camouflage-premium-quality-wordpress-theme-free/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This time I have a Gift for you. Its Stunning, Multiple Skin <a href="http://www.wordpress.org" target="_blank">WordPress</a> Theme allowing you full customization. Here are some of the features to rock you:</p>
<ul>
<li>Great Eye-catching Look.</li>
<li>Multiple Skins &#8211; which will change the look of your site, you can develop your own skins.</li>
<li>Fully Configurable Slideshow &#8211; show or hide it wherever you want.</li>
<li>Unlimited Submenus &#8211; adjust automatically with screen edge</li>
<li>Hybrid Look &#8211; you can use it on a blog site or a simple website or in a combination.</li>
<li>Built-in Social Media + Widget</li>
<li>Featured Post Widget</li>
<li>Google Analytics Integration</li>
<li>Custom Blog Menu</li>
<li>WordPress 3.x.x Menus</li>
<li>Pleasing Menu Animation</li>
<li>More than 40 Formatting Styles with Shortcodes</li>
<li>And lot more &#8230;</li>
</ul>
<p>Its an open source project which is in beta stage, you can contribute to the project at <a href="https://github.com/usmanhalalit/camouflage" target="_blank">github</a>. Its released under BSD License and I don&#8217;t expect you to use it in ill tasks.</p>
<p><a href="http://usman.it/?theme=Camouflage&#038;passkey=10070873074eaf0754e9fbc" target="_blank"><strong>See a live DEMO of this site</strong></a>  (after 5 mins it will be on original look)</p>
<p><a href="http://usman.it/resources/camouflage.zip"><strong>Download from Here</strong></a><br />
if you don&#8217;t know how to install WordPress themes then <a href="http://codex.wordpress.org/Using_Themes" target="_blank">read this tutorial</a>.</p>
<p><a href="http://usman.it/resources/camouflage.zip"><img src="http://usman.it/wp-content/uploads/2011/10/camouflage-wordpress-theme1-e1320002837687.png" alt="Camouflage WordPress Theme" title="Camouflage WordPress Theme" width="600" height="292" class="aligncenter size-full wp-image-107" /></a></p>
<p><strong>Here is a list of shorcodes, apply these in your posts and see the magic.</strong></p>
<p><a href="http://codex.wordpress.org/Gallery_Shortcode" target="_blank">Learn how to use shortcodes</a>.</p>
<p><strong>Lines</strong></p>
<p>Example of line. You can omit type, in that case there will be no back to top link.</p>
<p>[line type="back" /]</p>
<p><strong>Columns</strong></p>
<p>Example of Columns </p>
<p>[one_third]</p>
<p>This is an example of one_third column. List of available columns:</p>
<p>one_half, one_third, two_third, three_fourth, one_fourth, one_fifth, two_fifth, three_fifth, four_fifth, one_sixth, five_sixth</p>
<p>[/one_third]</p>
<p><strong>Icons</strong></p>
<p>[icon type="smyle" /]</p>
<p>There are many icon types for you, here is a list:</p>
<p>arrowdown, arrowleft, arrowright, arrowup, callout, circle, dollar, email, equal, exclamanation, handdown, handup, hadright, handleft, handpointer, happy, info, ok, plus, power, question, quote, right, rotate, smyle, wrong and www</p>
<p><strong>Boxes</strong></p>
<p>[box color="lightgray" border_color="blue"]</p>
<p>Example of box, you can omit color and/or border_color for default setting.</p>
<p>[/box]</p>
<p>It requires WordPress 3.0.0 or higher.<br />
Enjoy the the free stuff and don&#8217;t forget to share the awesomeness with your friends. Stay tuned for more amazingly free stuffs.</p>
]]></content:encoded>
			<wfw:commentRss>http://usman.it/camouflage-premium-quality-wordpress-theme-free/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress like Option feature for your CodeIgniter application</title>
		<link>http://usman.it/wordpress-like-option-feature-for-your-codeigniter-application/</link>
		<comments>http://usman.it/wordpress-like-option-feature-for-your-codeigniter-application/#comments</comments>
		<pubDate>Sun, 30 Oct 2011 18:25:34 +0000</pubDate>
		<dc:creator>Muahammad Usman</dc:creator>
				<category><![CDATA[Project]]></category>
		<category><![CDATA[Resource]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://usman.it/?p=17</guid>
		<description><![CDATA[If you have developed a large application you may have faced this problem, in some cases we have some settings or options to save in the database but the data is not so large to create a db table for &#8230; <a href="http://usman.it/wordpress-like-option-feature-for-your-codeigniter-application/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you have developed a large application you may have faced this problem, in some cases we have some settings or options to save in the database but the data is not so large to create a db table for it, also it may do not require many rows. In that case we should have a table for settings, where we can store all our settings or options with a key then retrieve it. Our option can be a text value or an array or an object. <a href="http://wordpress.org/" target="_blank">WordPress</a> has a really good feature for such cases its the <a href="http://codex.wordpress.org/Option_Reference" target="_blank">Option Mechanism</a>. By using the appropriate function, options can be <a title="Function Reference/add option" href="http://codex.wordpress.org/Function_Reference/add_option">added</a>, <a href="http://codex.wordpress.org/Function_Reference/update_option" target="_blank">changed</a>, <a href="http://codex.wordpress.org/Function_Reference/delete_option" target="_blank">removed</a>, and <a href="http://codex.wordpress.org/Function_Reference/get_option" target="_blank">retrieved</a>.</p>
<p>I loved this feature too much that I added such feature in my <a href="http://codeigniter.com" target="_blank">CodeIgniter</a> applications, because I don&#8217;t always use WordPress. Now I want to share my code with you which may help you in various tasks. Its not the exact same as WordPress. I have used 4 functions for it add_option, update_option, get_option and delete_option. The good part is you can store a PHP array, object or a string value (including number) with add_option(&#8216;name_of_option&#8217;,'value&#8217;) or with update_option(&#8216;name_of_option&#8217;,'value&#8217;) and whenever you retrieve your data with get_option(&#8216;name_of_option&#8217;) it returns the data with the same format.<br />
(Sorry, if you have used it in WordPress you may already know it and some info below, but its for those who haven&#8217;t used).</p>
<p>You may download the code from <a href="https://github.com/usmanhalalit/option_helper" target="_blank">github</a>, also any contribution is highly appreciated.</p>
<p><strong>Functions:</strong></p>
<p>add_option(&#8216;name_of_option&#8217;,'value&#8217;) will store data in the db with &#8216;name_of_option&#8217; if the &#8216;name_of_option&#8217; is already used it will return false, use add_option if you want to store a data for the first time such as installing an app.</p>
<p>update_option(&#8216;name_of_option&#8217;,'value&#8217;) will update the &#8217;name_of_option&#8217; if it is already used. If &#8217;name_of_option&#8217; is not found it will add &#8217;name_of_option&#8217;. So use update_option in general case.</p>
<p>get_option(&#8216;name_of_option&#8217;) will return the value of &#8217;name_of_option&#8217; in original data type. Will return false if option is not found.</p>
<p>get_option(&#8216;name_of_option&#8217;) will return the value of &#8217;name_of_option&#8217; in original data type. Will return false if option is not found.</p>
<p><strong>Usage Example:</strong></p>
<p>Below is the usage for CodeIgniter controller, I have made it as a CodeIgniter Helper. You will find instructions below on how to implement this Helper. I assume you have database set up in application/config/database.php</p>
<pre class="brush: php; title: ; notranslate">
public function index()
{
	//load our helper,
	//better to autoload it by editing application/config/autoload.php
	$this-&gt;load-&gt;helper('option_helper');

	//text value example
	update_option('username','Usman');
	echo get_option('username');
	//array example
	$user_info=array(
		'username'		=&gt;	'Usman',
		'profession'	=&gt;	'Developer',
		'location'		=&gt;	'Sylhet, Bangladesh',
	);
	update_option('user_info',$user_info);
	$return_value=get_option('user_info');
	print_r($return_value);
	echo $return_value['location'];

	//delete example

	delete_option('username');
	//delete_option('user_info');
}
</pre>
<p><strong>Implementation:</strong></p>
<p><strong>1</strong>. Create a table in your database like below (of course its MySQL) :</p>
<pre class="brush: sql; title: ; notranslate">

CREATE TABLE IF NOT EXISTS `tbl_option` (

`option_id` bigint(20) NOT NULL AUTO_INCREMENT,

`option_name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,

`option_value` longtext COLLATE utf8_unicode_ci NOT NULL,

`option_type` varchar(20) COLLATE utf8_unicode_ci NOT NULL,

PRIMARY KEY (`option_id`),

UNIQUE KEY `option_name` (`option_name`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=59 ;
</pre>
<p><strong>2</strong>. As I have made a CodeIgniter Helper for this, keep the code in application/helpers folder (in most cases) and name it option_helper.php. I haven&#8217;t used any model for simplicity.</p>
<p><strong>3</strong>. Copy the code below and paste it to your option_helper.php, that&#8217;s it.</p>
<pre class="brush: php; title: ; notranslate">

&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
function add_option($name,$value)
{
      $CI =&amp; get_instance();
      $CI-&gt;load-&gt;database();
	$query=$CI-&gt;db-&gt;select('*')-&gt;from('tbl_option')-&gt;where('option_name',$name)-&gt;get();

	//option already exists
	if($query-&gt;num_rows() &gt; 0)
		return false;

	$data_type='text';
	if(is_array($value))
	{
		$data_type='array';
		$value=serialize($value);
	}
	elseif(is_object($value))
	{
		$data_type='object';
		$value=serialize($value);
	}

	$data=array(
		'option_name'=&gt;$name,
		'option_value'=&gt;$value,
		'option_type'=&gt;$data_type,
	);
	$CI-&gt;db-&gt;insert('tbl_option',$data);
}

function update_option($name,$value)
{
	$CI =&amp; get_instance();
	$CI-&gt;load-&gt;database();

	$data_type='text';
	if(is_array($value))
	{
		$data_type='array';
		$value=serialize($value);
	}
	elseif(is_object($value))
	{
		$data_type='object';
		$value=serialize($value);
	}

	$data=array(
		'option_name'=&gt;$name,
		'option_value'=&gt;$value,
		'option_type'=&gt;$data_type,
	);
	$query=$CI-&gt;db-&gt;select('*')-&gt;from('tbl_option')-&gt;where('option_name',$name)-&gt;get();

	//if option already exists then update else insert new
	if($query-&gt;num_rows() &lt; 1) return $CI-&gt;db-&gt;insert('tbl_option',$data);
	else		  return $CI-&gt;db-&gt;update('tbl_option',$data,array('option_name'=&gt;$name));
}

function get_option($name)
{
	$CI =&amp; get_instance();
	$CI-&gt;load-&gt;database();
	$query=$CI-&gt;db-&gt;select('*')-&gt;from('tbl_option')-&gt;where('option_name',$name)-&gt;get();
	//option not found
	if($query-&gt;num_rows() &lt; 1) return false; 	 	$option=$query-&gt;row();

	if('text'==$option-&gt;option_type)
		$value=$option-&gt;option_value;
	elseif('array'==$option-&gt;option_type || 'object'==$option-&gt;option_type)
		$value=unserialize($option-&gt;option_value);

	return $value;
}

function delete_option($name)
{
	$CI =&amp; get_instance();
	$CI-&gt;load-&gt;database();
	return $CI-&gt;db-&gt;delete('tbl_option',array('option_name'=&gt;$name));
}
</pre>
<p>If you have found it useful, please comment below. Any bug report or suggestions are most welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://usman.it/wordpress-like-option-feature-for-your-codeigniter-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>English to Bangla Dictionary for Android</title>
		<link>http://usman.it/english-bangla-dictionary-android/</link>
		<comments>http://usman.it/english-bangla-dictionary-android/#comments</comments>
		<pubDate>Sun, 30 Oct 2011 10:13:59 +0000</pubDate>
		<dc:creator>Muahammad Usman</dc:creator>
				<category><![CDATA[Project]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[bangla]]></category>
		<category><![CDATA[dictionary]]></category>

		<guid isPermaLink="false">http://usman.it/?p=83</guid>
		<description><![CDATA[Its being a long time since we planned to develop a Bangla language related application for Android. After a long discussion we decided to create a Bangla Dictionary based on Google Dictionary. The main-pain was the font, Android is not &#8230; <a href="http://usman.it/english-bangla-dictionary-android/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Its being a long time since we planned to develop a Bangla language related application for Android. After a long discussion we decided to create a Bangla Dictionary based on Google Dictionary. The main-pain was the font, Android is not yet matured enough to handle Unicode. After some challenges we successfully integrated universal Bangla font with our new Android app. We have published the app in the <a href="https://market.android.com/details?id=net.halalit.bangladict" target="_blank">Android Market</a>. The day we published the app totally amazed us with an overwhelming response, we never expected our app will be loved by so many people. Few days ago the total downloads exceeded 5000 with 30 ratings averaging 4.6 / 5 . The number may not be that high for an international audience focusing app, but its real high for Bengali people focusing app. <a href="https://market.android.com/details?id=net.halalit.bangladict" target="_blank"><strong>Download the app from the market by clicking here</strong></a>.</p>
<p><a href="https://market.android.com/details?id=net.halalit.bangladict" target="_blank"><img src="http://usman.it/wp-content/uploads/2011/10/feature_graphic1-e1320003049198.png" alt="Bangla Dictionary for Android" title="Bangla Dictionary for Android" width="598" height="292" class="aligncenter size-full wp-image-109" /></a></p>
<p></a>Works fine with most devices, some Android devices with less or no complex script(most of these are called Jukto Borno in Bangla) support may show some Bangla words (with Jukto Borno) broken. Devices with complex script support show everything perfectly.</p>
]]></content:encoded>
			<wfw:commentRss>http://usman.it/english-bangla-dictionary-android/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creating a simple Facebook Application</title>
		<link>http://usman.it/creating-a-simple-facebook-application/</link>
		<comments>http://usman.it/creating-a-simple-facebook-application/#comments</comments>
		<pubDate>Wed, 26 Oct 2011 17:45:21 +0000</pubDate>
		<dc:creator>Muahammad Usman</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://usman.it/?p=15</guid>
		<description><![CDATA[Facebook Applications are getting much popular these days, its good, but the bad is Facebook frequently changes its API, which causes the resource and tutorials on this subject to be obsolete. That&#8217;s why I decided to write a up to &#8230; <a href="http://usman.it/creating-a-simple-facebook-application/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Facebook Applications are getting much popular these days, its good, but the bad is Facebook frequently changes its API, which causes the resource and tutorials on this subject to be obsolete. That&#8217;s why I decided to write a up to date post on how to create an IFrame based Facebook Application using PHP. I am using <a href="https://github.com/facebook/php-sdk" target="_blank">PHP SDK</a> (3.1) and Graph API, you have to download PHP SDK from <a href="https://github.com/facebook/php-sdk" target="_blank">here</a>. Well, I am covering the coding part here and not going through how to create and setup a Facebook Application, if you don&#8217;t know how then <a href="http://net.tutsplus.com/tutorials/javascript-ajax/design-and-code-an-integrated-facebook-app/" target="_blank">this article</a> might be a good read.</p>
<p>I will create an app which will show all friends&#8217; name. So we will learn, how to &#8230;<br />
-Include PHP SDK<br />
-Authenticate the user<br />
-Set scope or permission<br />
-Get friend list<br />
-Print friends&#8217; names</p>
<p>I am using an index.php file and a folder named fb_sdk which will contain facebook.php and base_facebook.php obtained from <a href="https://github.com/facebook/php-sdk" target="_blank">Facebook PHP SDK</a> (path_to_php_sdk/src/).  Now we will start writing code in index.php</p>
<p>First we will include the PHP SDK file like below:</p>
<pre class="brush: php; title: ; notranslate">
require 'fb_sdk/facebook.php';
</pre>
<p>Now we will instantiate the PHP SDK, here we will provide the Application Id (appId) and Application Secret (secret) obtained from our App settings in Facebook.</p>
<pre class="brush: php; title: ; notranslate">
$facebook = new Facebook(array(
  'appId'  =&gt; 'your_app_id',
  'secret' =&gt; 'your_app_secret',
));
</pre>
<p>Now we will get user info from Facebook to check if the user is authenticated or not</p>
<pre class="brush: php; title: ; notranslate">
$user = $facebook-&gt;getUser();

// We may or may not have this data based on whether the user is logged in.
//
// If we have a $user id here, it means we know the user is logged into
// Facebook, but we don't know if the access token is valid. An access
// token is invalid if the user logged out of Facebook.

if ($user) {
  try {
    // Proceed knowing you have a logged in user who's authenticated.
    $user_profile = $facebook-&gt;api('/me');

  } catch (FacebookApiException $e) {
    error_log($e);
    $user = null;
  }
}
</pre>
<p>Now if the user is not authenticated or user has not allowed our app to access certain info then we will redirect user to a URL called loginUrl to allow our app to access his info. As we need user&#8217;s friend list only we are asking for read_friendlists permission only. You can ask for additional permissions if you need, a list permissions can be found <a href="https://developers.facebook.com/docs/reference/api/permissions/" target="_blank">here</a>.</p>
<pre class="brush: php; title: ; notranslate">
// Login or logout url will be needed depending on current user state.
if ($user) {
  $logoutUrl = $facebook-&gt;getLogoutUrl();

} else {
  $loginUrl = $facebook-&gt;getLoginUrl(array(
            'scope' =&gt; 'read_friendlists', //you can add more permissions here separated by commas
			'redirect_uri'=&gt;'https://apps.facebook.com/usman_test_app/' //give your app's canvas URL here, its just example
            )
       );
    //redirect user to loginUrl
    echo &quot;&lt;script type='text/javascript'&gt;top.location.href = '$loginUrl';&lt;/script&gt;&quot;;
    exit;
}
</pre>
<p>Now we have permission to access user&#8217;s friend list. So we have to get the friend list using the api() function. The returned value will be an array, then we will loop through the array and print the friend&#8217;s name.</p>
<pre class="brush: php; title: ; notranslate">

?&gt;
&lt;!doctype html&gt;
&lt;html xmlns:fb=&quot;http://www.facebook.com/2008/fbml&quot;&gt;
  &lt;head&gt;
    &lt;title&gt;Facebook App Example&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;?php if ($user){
			//lets get the friend list
			$friends   = $facebook-&gt;api('/me/friends');
			//check if we have a valid list
			if(!is_array($friends))
				exit(&quot;Unable to get friend list.&quot;);

			//now we will print friend name from array
			foreach($friends['data'] as $friend)
			{
				echo $friend['name'].'&lt;br/&gt;';
			}
	?&gt;

    &lt;?php } ?&gt;

  &lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Well we are done now. You have to put index.php and the fb_sdk folder in the root of your app folder. You can access the app by visiting your Canvas URL If you like the post please share it and comment below. Also you can comment if you have any problem or relevant question.</p>
]]></content:encoded>
			<wfw:commentRss>http://usman.it/creating-a-simple-facebook-application/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Goals of Last Quarter of 2011</title>
		<link>http://usman.it/goals-of-last-quarter-of-2011/</link>
		<comments>http://usman.it/goals-of-last-quarter-of-2011/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 19:17:00 +0000</pubDate>
		<dc:creator>Muahammad Usman</dc:creator>
				<category><![CDATA[My Life]]></category>
		<category><![CDATA[goals]]></category>

		<guid isPermaLink="false">http://usman.it/?p=7</guid>
		<description><![CDATA[I will&#8230;..1. Reach 2000 reputation level at http://stackoverflow.com/2. Buy an Asus Eee Pad Transformer (tablet)  *3. Finish the book &#8220;Professional PHP5&#8243; from wrox4. Write 5 blog posts on tech stuff5. Release 2 open source projects6. Park http://womenwise.com.au/ in a proper place7. Have at &#8230; <a href="http://usman.it/goals-of-last-quarter-of-2011/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I will&#8230;..<br clear="none" />1. <del>Reach 2000 reputation level at <a href="http://stackoverflow.com/" rel="nofollow nofollow" shape="rect" target="_blank">http://stackoverflow.com/</a></del><br clear="none" />2. <del>Buy an Asus Eee Pad Transformer (tablet) </del> *<br clear="none" />3. <del>Finish the book &#8220;Professional PHP5&#8243; from wrox</del><br clear="none" />4. <del>Write 5 blog posts on tech stuff</del><br clear="none" />5. <del>Release 2 open source projects</del><br clear="none" />6. <del>Park <a href="http://womenwise.com.au/" rel="nofollow nofollow" shape="rect" target="_blank">http://womenwise.com.au/</a> in a proper place</del><br clear="none" />7. <del>Have at least 1 tour outside my comfort zone</del><br clear="none" />8. <del>Fork some code on CodeIgniter&#8217;s github repository</del><br clear="none" />9. <del>Read at least 1 Islamic book</del></p>
<p><del>(2 entries hidden)</del></p>
<p>Inshaallah (God willing).</p>
]]></content:encoded>
			<wfw:commentRss>http://usman.it/goals-of-last-quarter-of-2011/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

