Archive for the ‘PHP’ category

Facebook Chat Invite API to Increase The Application Users.

March 13th, 2009

Over the last few days, we have seen some major changes on Facebook developer platform which will increase the application developers to engage more users with their applications. I will try to write on them one by one in near future whenever I get time. Today, i’m going to discuss “Chat Invite API” with an example and I will also focus on area(s) how we can use this API to get more users attention.

Chat invite API Enables your users to initiate Facebook Chat with their friends from within your applications. Great! Let’s give this responsibility to users to bring their friends in our application.

Three main attributes of this API are..

  • msg (required)
  • condensed
  • exclude_ids

an example could be like the following..

<fb:chat-invite msg="let's play a game!" condensed="false" exclude_ids="1,2,3"/>

2 things are very important here, “msg” that comes in the chat input box when you select an online friend from the list, so be sure that you put something related to your application. Setting up the application URL will be right idea along with some text.

I.e :

 msg ="Come join me! <?=$base_url;?>"

another attribute is “exclude_id”, let’s exclude those who haven’t added this application and idle. So that we will show those users who have not added our application and who are idle. Let’s look at the complete example that does this job for us.

<?php 
include_once("config.php");
$users = $facebook->api_client->fql_query("SELECT uid FROM user WHERE is_app_user = 1 and uid IN (SELECT uid2 FROM friend WHERE uid1 = {$fbuser})");
/*
 * Now, let's make these ids comma seperated (1,2,3)
 */
$arFriends = "";
    // Build an delimited list of users...
    if ($users){
        $arFriends .= $users[0]["uid"];
        for ( $i = 1; $i &lt; count($users); $i++ )    {
            if ( $arFriends != "" )        $arFriends .= ",";
            $arFriends .= $users[$i]["uid"];
        }
    }
?>
//now place this code where you want to show your chat invite box.
<fb:js-string var="chatInvite">  <fb:chat-invite msg="Come join me! <?=$base_url;?>" condensed="true" exclude_ids="<?=$arFriends;?>"/> </fb:js-string>
    <div id="chat_invite_container"></div>
<script> document.getElementById('chat_invite_container').setInnerFBML(chatInvite); </script>

Chat with friends from Canvase Page

Chat with friends from Canvase Page

Thats it! Now, we can allow users to talk to their friends directly from your application.

Reference : http://wiki.developers.facebook.com/index.php/Fb:chat-invite

A Comparative Study on Elgg, Drupal and WordPress!

November 22nd, 2008

Elgg is known for a social networking application, Drupal is known as a Content Management System and WordPress is known for blogging. But with all these three applications you can develop a huge community based application.

Purpose of this comparative study was to find out a better application to develop a community based application. To do that, I considered few simple things as follows.

  • How easy to create a plug-in/widget/module

  • Number of available built-in plug-ins

  • Documentation and

  • Themes

and followings are the results that I have got after installing them, playing with them and studying on them..

Elgg:

Creating a plug-in : As usual, nothing too complicated.

Available plug-ins: There around 200 plug-ins found and most common plug-ins are there.

Documentation : They have good documentations on their core developments. But its not vastly described

Themes : There are only few themes found. This is bad side of these applications that it doesn’t have too many built-in themes.

Summary : A social networking application. Installation is very easy, same for widget and plug-in. mainly focused on social networking to connect friends and make a common place for all friends. It has got all plug-ins and widgets that required creating a social application. Problem is there are not too much options or built-in features and customizations will be required in most of the cases. Although creating plug-ins and widgets will not be a big deal. It has very good drag drop options and easy installations system. Community is not that big in fact! And main problem they got only few built-in themes!

Drupal:

Creating a plug-in : Ain’t that easy as they don’t inspire you to code. What we can do is…we can install the related module and we can customize it! Or creating a module will be a little bit complected.

Available plug-ins: A lot! Saw almost all needed features which they called MODULE.

Documentation : They have PDF version of the document. And its really cool.

Themes : There are sufficient Themes available in Drupal official site and in third party site but developing a Drupal will be a little be tricky. It has to go through some enabling/disabling stuff and it has to go through some API calls as well.

Summary : Mainly a CMS but they also call it CMF. So this Content management Framework supposed to allow to customize the code and make it on our own way. It has some problem on installations. Like php.ini has default memory limit 8M but Drupar required 16M. And they also have some other complication over installations. But, after all it can be a nice choice for community based application.

WordPress:

Creating a plug-in : Not a big deal at all! In fact, this is one of the easiest among others.

Available plug-ins: Thousands by hundreds of developers!

Documentation : WordPress got best documentations among all these names I mentioned.

Themes : Really easy!

Summary : WordPress is popular for its huge community and the flexibility. Their documentation is simply awesome. Creating plug-ins and theme are easier than any other one I’m comparing here. It has got all the necessary plug-ins and widgets they any kind of community based application needs.

In My Humble Opinion : WordPress is the winner :)

A fresher question – if I don’t get chance to work then how will I get experience?

November 8th, 2008

I have been hearing this question a lot for last one or two years. Two years back I used to ask this question to myself and seniors as well. I was desperately looking for a job just after completing my under graduation. I dropped my resume to many places and they didn’t call me just because I didn’t have any previous experience except some university projects.

I don’t know, I feel, I have this soft corner for fresher, so whenever I can, just try to help them, encourage them make them believe that they can overcome this situation. Well, because I believe in hard work and I came out from this situation!

So, I better tell all fresher how I came out from this situation, maybe it will help them.

I started my journey with the help of Ahsan, he actually recommended me to that company named Alliance Creation and I carried the rest. [Note: it's always good to stay in touch with some Senior IT developers; so that, somehow they know u have some capability to work]. They used to work on PHP project and I was studying on .NET at that time. My all university projects where done by either Java or .Net. [Note: please try to do your university project by yourself; do solve the same problem using different language] So it was completely new scripting language for me to start with. But as I was desperate to be a developer, I took the challenge. At the beginning, life was hell because I was a dumb!! A super dumb who didn’t know how to submit a form using PHP, Who didn’t know how to get value from returned Array (). Well, our universities don’t teach us, do they? But I accepted all those criticism and kept myself positive. My starting salary was surely lower than a rickshaw driver [Note: please don't care about your starting salary!]. After 6 months of work  I decided to leave the company because I got enough confident to work on other better places. But company requested me to stay with them. I did! But in next 6 months I joined TripperLabs which was my third company!

Ok, I’m using too much “first person” here, sorry for that. But my intention is not to talk about myself; rather I want to inspire you that you can!

My former colleague Emran wrote a similar post here, I guess you can get more help from there. Just finishing this with some request…

Try to..

  • Stay positive
  • Work hard, damn hard and believe you can!
  • Be a quick learner
  • Have problem solving ability!
  • Be good at communication

All the best for you newcomer!

Get Adobe Flash playerPlugin by wpburn.com wordpress themes