Showing posts with label codes. Show all posts
Showing posts with label codes. Show all posts

Thursday, July 25, 2013

How to put Facebook Comment Box on blog ?


If you are always logged on Facebook and you are managing a blog, it is good to put a Facebook comment box plugin there. It can also publish the comment with a link to your blog if someone posted a comment to your blog. With that, you can have more visitors to your blog site.

You can also check if someone leaves a comment on your blog without checking all the pages or posts on your blog. You can also manage the comments and make a reply just using your Facebook account

Facebook Comment Box Screenshot
Comment Box Screenshot

 Let’s start the process.


PART 1 : Creating your apps


1. Go to https://developers.facebook.com/apps and create a new app. See image below.

Create New App

2. Type any valid application name and click “Continue”.

Enter Application Name

3. Enter the captcha code and click “Continue”.

Captcha Code

4. Get your Comment Box App ID. This is important. Copy and save it somewhere in your computer. You will need this later.
 
App ID

5. On App Domains, enter your domain name. I am using blogspot that’s why I entered blogspot.com.
Disable Sandbox Mode, enter you blogsite url and hit “Save” button.

Basic Settings

Now, let's proceed to the second part and put the codes into your blogger account.


PART 2 : Applying the codes


1. Login to your blogger account.

2. Go to Template and click Edit HTML.

3. Put this code inside the <html> tag.

Result should look like this:

<html xmlns:fb='http://www.facebook.com/2008/fbml'>


4. Insert this after the <body> tag.



5. Insert this code before the </head> tag.


6. Find this line <b:includable id='comment-form' var='post'>
After that code, insert the following codes below


7. After putting the codes in your template, hit “Save Template” button.


Go to your blog and check your blog post. You will see a comment box below your post.

Wednesday, July 17, 2013

Turbo C: Variables and User Input

Getting input value

In every program, variables are declared and used for the user inputs. From my previous post, we already know how to declare variables, but those variables are static or cannot be changed when we run our program.


This time, we are going to create a program that will let the user to input the value. This basic program will ask the user to enter a value that will be set to our variables, and then the program will get the sum of two inputs.

Code:




By using the scanf(“%d”, &x) we are able to get the user input. (“%d”, &x) will get an integer value of the input and will be assigned in variable x.




Tuesday, July 16, 2013

Turbo C : Variable Declaration

Declaring Variables

Variables are used to hold a value. It can be a text or numbers or even both. This is very useful in programming especially when you want to display some text/numbers multiple times.

There are types of variables used to make a program. These will give the variables a classification that the computer will understand.

On this part, we will create a simple mathematical addition. Here is the code.





Looking at the codes, we used int type of variable. It is used because we are using variables to hold numeric values.

x, y and z are the variables that we declared. You can use any alphanumeric characters to declare variables. It can be (A, B, C) , (num1,num2,num3),  or it can be a name of your choice.

The x has a value of 100 and y has 200, but z doesn’t have a value. It’s ok, we can declare a value for z later.

printf("Value of X is = %d \n", x);       //---- %d will call the integer value of x
printf("Value of Y is = %d \n", y);       //---- %d will call the integer value of y

This statement will display a text and a variable.
The backslash followed by letter n “\n” will begin a new line.

z=x+y;
printf("The sum of X and Y is = %d", z);

This line will declare the value of z.  z=x+y , it is clear that the value of z will add  the  value of x and  y. And the last part will print the value of z.

Output:




Sunday, July 14, 2013

Turbo C : Hello World

Writing Hello World Program


To write a C program, we need a compiler. You can use compilers like DevC++ and CodeBlocks but Turbo C is indicated in our title, so we are going to use "Turbo C". I prefer using Turbo C because some codes doesn't work with the new compilers. You will see what I mean if you try to use different compilers. If you still don't have turbo c, you can download it here (link).

This is a basic program written in C Language. This program will just print the hello world text. It simply show you the basic structure of a program and the use of printf function.


#include<stdio.h>
#include<conio.h>

void main()
{
clrscr();
printf("HELLO WORLD");
getch();
}


The first two lines are the libraries. There are lots of libraries
that is used to create a program. It is used to allow the functions
that we use in every program.

clrscr() - it clears all previous text displayed.
Printf("hello world") - a function to display a text. The function
that is most important in every program.
getch() - without this, your program will just flash on your screen.

Output:



Related Posts Plugin for WordPress, Blogger...