How to install chromium browser in fedora 19

To install chromium browser in fedora you need to add a repo file to the yum.repos.d dir as it is not available in rpm fusion repos. So download the repo file from the link below:

https://repos.fedorapeople.org/repos/spot/

Right click on the fedora-chromium-stable.repo and save it to you hard drive by selecting “Save Link As”.

Now open terminal and cd to the location/dir where you downloaded the file. After that run this command:

sudo cp fedora-chromium-stable.repo /etc/yum.repos.d

And now time to install it:

sudo yum -y install chromium

And that’s it.

 

Pull pages data via facebook graph

In the last article we discussed how to create or extend access token for facebook pages. Today we are going a bit further and writing a script where we can pull some pages data.
So here is the full code, i will explain it below where necessary.

Save the following code as index.php(or whatever name you like).
[cc lang=”php” escaped=”true” nowrap=”false” noborder=”true” line_numbers=”false” lines=”80″ tab_size=”4″]
<?php
// Facebook APP [Pages App for access tokens]
define(‘APP_ID’, ‘enter_app_id_here’);
define(‘APP_SEC_KEY’, ‘enter_app_secret_here’);

// Access Token
define(‘ACCESS_TOKEN_PAGE1’, ‘enter_access_token_here_for_page1’);
define(‘ACCESS_TOKEN_PAGE2’, ‘enter_access_token_here_for_page2’);

// Page IDs
define(‘APP_PAGE_ID_PAGE1’, ‘enter_page1_id_here’); // for page1
define(‘APP_PAGE_ID_PAGE2’, ‘enter_page2_id_here’); // for page2

// Create array for pages ids, tokens, country etc
$total_pages = array( array( ‘Pageid’ => APP_PAGE_ID_PAGE1, ‘Access_token’ => ACCESS_TOKEN_PAGE1, ‘Country’ => ‘FINLAND’ ), array( ‘Pageid’ => APP_PAGE_ID_PAGE2, ‘Access_token’ => ACCESS_TOKEN_PAGE2, ‘Country’ => ‘SINGAPORE’ ) );

// periods
$day = ‘day’;
$week = ‘week’;

$date = date(“10-07-2013”);

foreach ($total_pages as $pages) {

$pageid = $pages[‘Pageid’];
$accesstoken = $pages[‘Access_token’];
$country = $pages[‘Country’];

// Daily People Talking About This [page_storytellers]
$fql_query_page_storytellers = ‘https://graph.facebook.com/’.’fql?q=SELECT+metric,value+FROM+insights+WHERE+object_id=’.$pageid.’+

AND+metric=”page_storytellers”+AND+end_time=end_time_date(“‘.$date.'”)+

AND+period=period(“‘.$day.'”)&access_token=’.$accesstoken;

$fql_obj_page_storytellers = file_get_contents($fql_query_page_storytellers, true);

//print_r($fql_obj_page_storytellers);
if(!empty($fql_obj_page_storytellers[‘data’])) {
echo $e1 = $fql_obj_page_storytellers[‘data’][‘0’][‘value’];
}
else
{
echo $e1 = “empty string”;
}

// Daily New Likes [page_fan_adds_unique]
$fql_query_page_fan_adds_unique = ‘https://graph.facebook.com/’.’fql?q=SELECT+metric,value+FROM+insights+WHERE+object_id=’.$pageid.’+

AND+metric=”page_fan_adds_unique”+AND+end_time=end_time_date(“‘.$date.'”)+

AND+period=period(“‘.$day.'”)&access_token=’.$accesstoken;

$fql_obj_page_fan_adds_unique = file_get_contents($fql_query_page_fan_adds_unique, true);

//print_r($fql_obj_page_fan_adds_unique);
if(!empty($fql_obj_page_fan_adds_unique[‘data’])) {
echo $e2 = $fql_obj_page_fan_adds_unique[‘data’][‘0’][‘value’];
}
else
{
echo $e2 = “empty string”;
}

}
?>
[/cc]

———————————————————–

PLEASE READ BEFORE USING THE SCRIPT

From the above script change the following vars:

enter_app_id_here = change this to your app id which you created.

enter_app_secret_here = enter the app secret here.

enter_access_token_here_for_page1 = enter the access token for page 1 if you have many pages.

enter_access_token_here_for_page2 = enter the access token for page 2 if you have many pages.

Note: You can add many pages as you want, but if you have only one page, just remove the 2nd array from the $total_pages array for page2. I have added country var to the array, this is only to recognize the data if have many pages while easy to save to database for later use.

enter_page1_id_here = You can get this while following the previous article.

enter_page2_id_here = You can get this while following the previous article.

For the periods, please read the facebook insight page for more details and usage.

There are not much changes required except from the above. But if you want to change the script for your need, go ahead and change/enhance it as it fits your requirements. You can pull more data by reading the insight page OR can save the data to database for later use.

———————————————————–

Open your browser and call index.php. One more thing, facebook does not provide latest data for pages so you have to go back last 3 days, if today is 14-07-2013, you can get the data for 10-07-2013 or maybe 11-07-2013.

How to create/extend access token for facebook pages

1st of all you have to create an app where we will allow permissions like manage_pages and read_insights etc to have full access to pages tokens etc from that app. So let’s start and try to make it as simple as we can.

1- Create an App.

2- Click on Permissions link. Add the permissions like manage_pages, read_insights etc in the Extended permissions text box and Save.

3- Go to graph explorer and select the app we just created from the dropdown. Click on the get access token button. Check necessary permissions like in step 2.

4- Type this in Graph API me/accounts and it will show all the pages which this user/account administrator of with info like access_token etc.

5- Copy the access token and use it in your PHP scripts for that page. Now you will be able to pull that page data like total likes, total dislikes etc using insights etc.

By default the access token will last for few hours, and for pages we need to have long session for that token.

Extend the access_token by using this url:

https://graph.facebook.com/oauth/access_token?client_id=APP_ID&client_secret=APP_SECRET&grant_type=fb_exchange_token&fb_exchange_token=PAGE_TOKEN

APP_ID = The app id we granted permissions like manage_pages, read_insights etc.

APP_SECRET = The app secret we granted permissions like manage_pages, read_insights etc.

PAGE_TOKEN = The token of the page we want to extend.

After extending, facebook will issue new access_token, use that in the script. The new extended token will have 2 months time.

Check page access_token validity by using debug url:

https://developers.facebook.com/tools/debug/access_token

Input the page access_token in the text box.

I will be writing another article on how to use the above app, page details in PHP and pull some page data. Stay tuned.

Scratch: simple editor by elementaryOS devs

elementaryOS is quite in news now a days and well it deserve that spot. It is one of those OS which really need praise and backup. The guys behind this OS are simply awesome, they are not full time developers but still managing it quite well. Luna is on its way, still in beta stage. What elementaryOS make different from other distributions is easy to use interface, clean UI, fast and reliable and finally some of their newly created apps. One of them is a text editor and called Scratch. It is very simple text editor but very nicely done by the devs with having nice UI and simple to use menu.

Scratch

From the preferences, one can easily change the settings like show line numbers, highlight current line, enabling some extensions like file manager, terminal etc. Quite useful if some one want to work with it.

Scratch-settings

Another nice feature is, if you open a system file which you can’t edit/save under normal user, you can easily save it any where and check it out.

Scratch-save-as-alt

One more nice feature is to compress the file from the editor. You can directly compress it from the save menu at the right hand side.

Scratch-compress

And the most impressive one i should say is the auto save feature, when ever you type some thing it will automatically save the changes to the file.

Well, there are more nice and simple features which depends on user needs. Did i miss some thing?

Give it a shot, you will not be disappointed.

Thunderbird: Auto select latest message on startup

When you start Thunderbird client normally will see the Mozilla page which can be changed from the preferences. But what about the message?, it will not automatically select the latest read or unread message. If you have thousands of mails in your inbox and think that scrolling up is pain. To me Thunderbird should have this feature by default, when start it 1st time it should automatically select the 1st latest message. But it is not.

No worries, there is an add on for this which do the job very well.

https://addons.mozilla.org/en-us/thunderbird/addon/auto-select-latest-message/

Open Thunderbird, go to Add on and search for ‘auto select latest message‘ without quotes and click to install it. Restart Thunderbird and you will see the change this time.

Thunderbird-auto-select-latest-messageAnd that should be it.

Facebook: How to create and add an app to a page

I will try to make it very easy. No extra steps or configuration here, just the basic stuff which will get you going.

1- Go to developer page, and click on create app button, and follow the onscreen instructions to create a new app.

2- Edit the page tab section with appropriate details. Also check out the App details section for privacy links and app icon if you wish to add one.

3- Enable sandbox mode for testing the app 1st.

4- Disable social discovery in Advanced section.

5- Add new testers and admins from Roles sections.

6- Now create a facebook page if don’t have yet OR use existing one to add the app to it.

7- Use the following URL to add the app:

https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&next=YOUR_URL

Change YOUR_APP_ID and YOUR_URL, and hit enter. Select the page from the dropdown and click Add button. You are done, your newly created app will be on the page in tabs section.

YOUR_APP_ID : Your newly created app id, can be retrieved from the settings.

YOUR_URL : The url to your app, hosted some where.

If everything is cool and want to go live, just disable sandbox mode and enable social discovery and your app will be live for users.