Creation Zone

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Monday, 27 July 2009

Instructions to Create a Facebook Application

Posted on 11:04 by Unknown
Here is a quick HOW-To document with step-by-step instructions to create a simple Facebook application.

  1. Create an account with Facebook at facebook.com
  2. To create an application in Facebook, go to Facebook Developers web site
  3. Click on Set Up New Application.
  4. Name the Appliaction and click on save changes.
  5. Enter a brief description for the application.
  6. On the left side of the page click on Canvas.
  7. Fill the application name in Canvas Page URL field.
  8. Fill the Canvas Callback URL field.

    Canvas Callback URL is the address of the website where the appliaction is hosted.
    For example if the appliaction is hosted on a website www.xyz.com, then the Canvas Callback URL address will be http://www.xyz.com/your_application.

  9. Click on save changes.
  10. A summary of the application is shown at this point.
  11. Sample code is shown at the bottom of this page. Click on the sample code.
  12. Download and unzip the tar.gz file.

    In the footprints folder, you will find a sample Facebook application with the file name index.php

  13. Facebook appliaction can be developed in JavaScript, PHP or HTML.

    For more details about the langauges in which the application can be developed, check Facebook Developers web site.

  14. Create your Facebook application and host it on any web site of your choice. Be aware that Facebook does not host the actual application - so you are on your own in finding a hosting site to deploy your Facebook application.

  15. You can test the application from the Canvas Page URL address.

    The url will be in the format http://apps.facebook.com/appliaction_name/


Few Caveats:

If the application is developed in JavaScript, note that all the functions may not work as expected in Facebook. For example, to set the value of 5 to a text box, the following is the code in JavaScript:

var k = 5;
document.getElementById("someid").value = k;


The above code may not work in Facebook application. The following modified code works in Facebook:
var k = 5;
document.getElementById("someid").setValue(k);


To see all the Facebook equivalent functions for the JavaScript functions, check the FBJS wiki page.

If you encounter the error, FBML Error : illegal tag "body" under "fb:canvas", remove the <body> tag from the HTML application. When Facebook parses the appliaction, it addes the <body> tag automatically.

The code shown below is ready to be used as an example Facebook application. This a very basic calculator with limited functionality.

To test how this example code works, visit the following URL:
http://apps.facebook.com/basic_calc

Sample Facebook Application : Simple Calculator


<html>

<head>
<style type = "text/css">
input {
width : 30px;
height: 30px;
font-size: 1.2em;
color: red;
}
</style>

<script language="JavaScript">
var num2 = 0 , num1=0;

function Assign(myvalue)
{
var button_value , Key = 0;
button_value = myvalue.getValue();

switch(button_value)
{
case '+':
case '-':
case '*':
case '/':
case '%':
{
key = button_value;
num1 = num2;
num2 = 0;
break;
}

case '=':
{
if (key == '+')
{
Sum(num1,num2);
}

if (key == '-')
{
Subtraction(num1,num2);
}

if (key == '*')
{
Product(num1,num2);
}

if (key == '/')
{
Reminder(num1,num2);
}

if (key == '%')
{
Modulo(num1,num2);
}
break;
}

case '+/-':
{
num2 = num2 * (-1);
document.getElementById("output").setValue(num2);
break;
}

default:
{
button_value = parseInt(button_value);
combine(button_value);
break;
}
}
}

function combine(input)
{
num2 = (num2 * 10) + input;
document.getElementById("output").setValue(num2);
}

function Cancel()
{
num2 = 0;
num1 = 0;
document.getElementById("output").setValue(num2);
}

function Sum(val1,val2)
{
var result;
result = val1+val2;
document.getElementById("output").setValue(result);
num2 = 0;
num1 = 0;
}

function Subtraction(val1,val2)
{
var result;
result = val1-val2;
document.getElementById("output").setValue(result);
num2 = 0;
num1 = 0;
}

function Product(val1,val2)
{
var result;
result = val1*val2;
document.getElementById("output").setValue(result);
num2 = 0;
num1 = 0;
}

function Reminder(val1,val2)
{
var result;
result = val1/val2;
document.getElementById("output").setValue(result);
num2 = 0;
num1 = 0;
}

function Modulo(val1,val2)
{
var result;
result = val1%val2;
document.getElementById("output").setValue(result);
num2 = 0;
num1 = 0;
}

</script>

<title>Very Basic Calculator</title>
</head>

<form>

<table border="1" bgcolor = "#CDCDCD">

<tr>
<td colspan="6"><input id ="output" type="text" name="result" value="0" style="width: 169px; height: 30px; color:blue;" readonly = "readonly"/></td>
</tr>

<tr>
<td><input type="button" name="one" value="1" onclick = "Assign(this)"/></td>
<td><input type="button" name="two" value="2" onclick = "Assign(this)"/></td>
<td><input type="button" name="three" value="3" onclick = "Assign(this)"/>
<td><input type="button" name="add" value="+" onclick = "Assign(this)"/></td>
<td rowspan="2"><input type="button" name="clear" style = "height : 64px;" value="C" onclick = "Cancel()"/></td>
</tr>

<tr>
<td><input type="button" name="four" value="4" onclick = "Assign(this)"/></td>
<td><input type="button" name="five" value="5" onclick = "Assign(this)"/></td>
<td><input type="button" name="six" value="6" onclick = "Assign(this)"/></td>
<td><input type="button" name="subtract" value="-" onclick = "Assign(this)"/></td>
</tr>

<tr>
<td><input type="button" name="seven" value="7" onclick = "Assign(this)"/></td>
<td><input type="button" name="eight" value="8" onclick = "Assign(this)"/></td>
<td><input type="button" name="nine" value="9" onclick = "Assign(this)"/></td>
<td><input type="button" name="multiply" value="*" onclick = "Assign(this)"/></td>
<td rowspan="2"><input type="button" name="equals" style = "height : 64px;" value="=" onclick = "Assign(this)"/></td>
</tr>

<tr>
<td><input type="button" name="zero" value="0" onclick = "Assign(this)"/></td>
<td><input type="button" name="negative" value="+/-" onclick = "Assign(this)"/></td>
<td><input type="button" name="modulus" value="%" onclick = "Assign(this)"/></td>
<td><input type="button" name="divide" value="/" onclick = "Assign(this)"/></td>
</tr>

</table>

</form>

</html>

________________
Technorati Tags:
 Facebook
Email ThisBlogThis!Share to XShare to Facebook
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • *nix: Workaround to cannot find zipfile directory in one of file.zip or file.zip.zip ..
    Symptom: You are trying to extract the archived files off of a huge (any file with size > 2 GB or 4GB, depending on the OS) ZIP file with...
  • C/C++: Printing Stack Trace with printstack() on Solaris
    libc on Solaris 9 and later, provides a useful function called printstack , to print a symbolic stack trace to the specified file descripto...
  • JDS: Installing Sun Java Desktop System 2.0
    This document will guide you through the process of installing JDS 2.0 on a PC from integrated CDROM images Requirements I...
  • Binary compatibility
    What's It? "Binary compatibility" (BC) is the ability of one machine to run software that was written for another without hav...
  • Solaris: NULL pointer bugs & /usr/lib/0@0.so.1 library
    Some programmers assume that a NULL character pointer is the same as a pointer to a NULL string. However de-referencing a NULL pointer (ie.,...
  • Database: Oracle Server Architecture (overview)
    Oracle server consists of the following core components: 1) database(s) & 2) instance(s) 1) database consists of: 1) datafil...
  • Sun: OpenJDK
    Open source JDK, that is. Sun Microsystems did it again -- As promised during JavaOne event back in May 2006, Sun made the implementation of...
  • Consolidating Siebel CRM 8.0 on a Single Sun SPARC Enterprise Server, T5440
    .. blueprint document is now available on wikis.sun.com . Here is the direct link to the blueprint:              Consolidating Oracle Siebel...
  • Oracle Internet Directory 11g Benchmark on SPARC T5
    SUMMARY System Under Test (SUT)     Oracle's SPARC T5-2 server Software     Oracle Internet Directory 11 g R1-PS6 Target Load     50...
  • Fix to Firefox 3 Crash on Solaris 10 x86
    Symptom : Firefox 3 crashes on Solaris 10 x86 when the web browser tries to render some of the HTML pages with SWF content in them. For exam...

Categories

  • 80s music playlist
  • bandwidth iperf network solaris
  • best
  • black friday
  • breakdown database groups locality oracle pmap sga solaris
  • buy
  • deal
  • ebiz ebs hrms oracle payroll
  • emca oracle rdbms database ORA-01034
  • friday
  • Garmin
  • generic+discussion software installer
  • GPS
  • how-to solaris mmap
  • impdp ora-01089 oracle rdbms solaris tips upgrade workarounds zombie
  • Magellan
  • music
  • Navigation
  • OATS Oracle
  • Oracle Business+Intelligence Analytics Solaris SPARC T4
  • oracle database flashback FDA
  • Oracle Database RDBMS Redo Flash+Storage
  • oracle database solaris
  • oracle database solaris resource manager virtualization consolidation
  • Oracle EBS E-Business+Suite SPARC SuperCluster Optimized+Solution
  • Oracle EBS E-Business+Suite Workaround Tip
  • oracle lob bfile blob securefile rdbms database tips performance clob
  • oracle obiee analytics presentation+services
  • Oracle OID LDAP ADS
  • Oracle OID LDAP SPARC T5 T5-2 Benchmark
  • oracle pls-00201 dbms_system
  • oracle siebel CRM SCBroker load+balancing
  • Oracle Siebel Sun SPARC T4 Benchmark
  • Oracle Siebel Sun SPARC T5 Benchmark T5-2
  • Oracle Solaris
  • Oracle Solaris Database RDBMS Redo Flash F40 AWR
  • oracle solaris rpc statd RPC troubleshooting
  • oracle solaris svm solaris+volume+manager
  • Oracle Solaris Tips
  • oracle+solaris
  • RDC
  • sale
  • Smartphone Samsung Galaxy S2 Phone+Shutter Tip Android ICS
  • solaris oracle database fmw weblogic java dfw
  • SuperCluster Oracle Database RDBMS RAC Solaris Zones
  • tee
  • thanksgiving sale
  • tips
  • TomTom
  • windows

Blog Archive

  • ►  2013 (16)
    • ►  December (3)
    • ►  November (2)
    • ►  October (1)
    • ►  September (1)
    • ►  August (1)
    • ►  July (1)
    • ►  June (1)
    • ►  May (1)
    • ►  April (1)
    • ►  March (1)
    • ►  February (2)
    • ►  January (1)
  • ►  2012 (14)
    • ►  December (1)
    • ►  November (1)
    • ►  October (1)
    • ►  September (1)
    • ►  August (1)
    • ►  July (1)
    • ►  June (2)
    • ►  May (1)
    • ►  April (1)
    • ►  March (1)
    • ►  February (1)
    • ►  January (2)
  • ►  2011 (15)
    • ►  December (2)
    • ►  November (1)
    • ►  October (2)
    • ►  September (1)
    • ►  August (2)
    • ►  July (1)
    • ►  May (2)
    • ►  April (1)
    • ►  March (1)
    • ►  February (1)
    • ►  January (1)
  • ►  2010 (19)
    • ►  December (3)
    • ►  November (1)
    • ►  October (2)
    • ►  September (1)
    • ►  August (1)
    • ►  July (1)
    • ►  June (1)
    • ►  May (5)
    • ►  April (1)
    • ►  March (1)
    • ►  February (1)
    • ►  January (1)
  • ▼  2009 (25)
    • ►  December (1)
    • ►  November (2)
    • ►  October (1)
    • ►  September (1)
    • ►  August (2)
    • ▼  July (2)
      • Instructions to Create a Facebook Application
      • Oracle Business Intelligence : Workaround / Soluti...
    • ►  June (1)
    • ►  May (2)
    • ►  April (3)
    • ►  March (1)
    • ►  February (5)
    • ►  January (4)
  • ►  2008 (34)
    • ►  December (2)
    • ►  November (2)
    • ►  October (2)
    • ►  September (1)
    • ►  August (4)
    • ►  July (2)
    • ►  June (3)
    • ►  May (3)
    • ►  April (2)
    • ►  March (5)
    • ►  February (4)
    • ►  January (4)
  • ►  2007 (33)
    • ►  December (2)
    • ►  November (4)
    • ►  October (2)
    • ►  September (5)
    • ►  August (3)
    • ►  June (2)
    • ►  May (3)
    • ►  April (5)
    • ►  March (3)
    • ►  February (1)
    • ►  January (3)
  • ►  2006 (40)
    • ►  December (2)
    • ►  November (6)
    • ►  October (2)
    • ►  September (2)
    • ►  August (1)
    • ►  July (2)
    • ►  June (2)
    • ►  May (4)
    • ►  April (5)
    • ►  March (5)
    • ►  February (3)
    • ►  January (6)
  • ►  2005 (72)
    • ►  December (5)
    • ►  November (2)
    • ►  October (6)
    • ►  September (5)
    • ►  August (5)
    • ►  July (10)
    • ►  June (8)
    • ►  May (9)
    • ►  April (6)
    • ►  March (6)
    • ►  February (5)
    • ►  January (5)
  • ►  2004 (36)
    • ►  December (1)
    • ►  November (5)
    • ►  October (12)
    • ►  September (18)
Powered by Blogger.

About Me

Unknown
View my complete profile