Week in errors, programming, and IE bug

Error 1: Last week I was working on a project where I had to write a complex SQL query by joining multiple tables. So I wrote the query and it was working well until yesterday when I found out the glitch in the query. My query was something like this:

SELECT a.name, b.thumbURL, b.imageTip, b.id, SUM(c.count) AS total FROM `someTable1` b LEFT JOIN `someTable2` a ON (b.userId = a.FBuserId) LEFT JOIN `someTable` c ON (b.id = c.imageId) WHERE b.weekId='$weekId' GROUP BY c.imageId ORDER BY total DESC

On primary look the query will seems okay and theoretically it should work as expected. But my table structure was kind of wrong (see below) and my data in table c was empty for that specific weekId value what resulted major glitch in the query affecting the result output. I was grouping by NULL value from table c which was giving me data but not correct. how? I had two row coming from table a and table b but I didn’t have any row from table c. I was expecting two row of result both having total=0. Instead I was getting one row of result because I was grouping it by null value. (If it seems complicated to you, I’m sorry! Not very good in words.) Thanks goes to my boss Sarah who helped me figure out the bug.

Error 2: This error was in the same SQL query above. My table structure for table c was:

CREATE TABLE IF NOT EXISTS `someTable` (
  `id` int(11) NOT NULL auto_increment,
  `dateJoined` datetime NOT NULL,
  `imageId` bigint(20) NOT NULL,
  `visitorId` bigint(20) NOT NULL,
  `count` enum('1','0') NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1

I was using mysql SUM() on enum entity which was giving me wrong result apparently. Cause for enum value the first one is equal to 1 and the second one is 2. Although I defined 0 as second enum value but when I use SUM it counted as second value==2. So if I had one entry in the above table with count value=0 and if I run this query:

INSERT INTO `someTable` (
`dateJoined` ,
`imageId` ,
`visitorId` ,
`count`
)
VALUES (
NOW( ) , '1', '0', '0'
);

SELECT SUM( `count` )
FROM someTable
WHERE imageId =0;

I will get 2 as result although I was expecting 0. I was wondering why there is no error message from mysql about using SUM on enum values. Any idea?

[Note: if you don't know, count is a reserve word in mysql so if you want to use it as entity name in a table make sure you put backtick (grave accent ) around `count` else you might get error]

IE bug: I have hit this bug so many times in my life that I think its worthy to write it down if it helps other people debugging stupid comma bug in IE. Yeah, this is about `rogue commas`. If you are a perl programmer you will know what I’m talking about. Sticking a comma after the last item is to make life easier when adding new value in the array, something like this:

var hash = {
  '.jpg'  : 1,
  '.jpeg' : 1,
  '.JPG'  : 1,
  '.JPEG' : 1,
};

All other browsers will parse it fine but IE will say F*** off. IE doesn’t have native debugging tool so good luck figuring out what happened. So I’m not sure which one is standard , putting a trailing comma or not but I’m sure that trailing comma can ruin your productive hours. So avoid trailing commas in javascript. Read this link by Dan Lee if you want to know more.

Posted in Programming, Troubleshooting, mysql | Tagged , , | 3 Comments

Using ssh, terminal and manual installation of any app in iPhone4 [iOS 4.3.3]

[ The post works as log of things[hacks] I did to make some apps work at July 4th, 2011 ]

Wanted to make my iphone4 which was running iOS 4.3.3 developer friendly. Things I needed was jail breaking it, install openSSH, MobileTerminal, Vim, FTP client and I’m done. Well, things doesn’t work out how a developer always think as a result he/she has to come up with different approach to solve the problem. OpenSSH was working after jail breaking iPhone but Mobile terminal was not working. Actually mobile terminal was broken in cydia store for 4.3.3, that means I had another way of installing app is manually doing it.

Using my linux laptop I copied the downloaded .zip file of Terminal to the iPhone’s /Application directory using following command.

$ scp Terminal-510.zip root@[your device's IP]:/Applications

I tried uploading unzipped Terminal.app file but it wasn’t working. So I had to install unzip app from cydia which I did manually going to cydia store. After installing unzip app in iPhone mnually from cydia I used the command below to unzip the terminal app file which I did after I logged into my iPhone.

$ ssh root@[your device's IP]
$ unzip Terminal-510.zip #my zip file name was Terminal-510.zip

Note: Your default password should be ‘alpine’. Make sure you change the default password of your iPhone.

Removed the unziped terminal app package from iPhone. Changed the permission and owners of files according to the instruction here. If you are wondering what command should you use you can follow the commands listed below.

Change ownerships on /Applications/Terminal.app to root:admin

$ chown root:admin Terminal.app/

Change permissions (recursively) on /Applications/Terminal.app to 644

$ chmod -R 644 Terminal.app/

Change permissions on /Applications/Terminal.app/Terminal 755

$ chmod 755 Terminal.app/Terminal

Change permissions on /Applications/Terminal.app 755

$ chmod 755 Terminal.app

Note: While executing the commands I was inside the /Applications folder.

You can reboot your device executing this command.

$ reboot

You will see an terminal app in your device appears after the reboot. Open the terminal log in as a root user and change the password. This is very IMPORTANT! If you don’t really know how to do it cydia homepage or googling will help you out. you also can check this link. Happy hacking!

Posted in Troubleshooting, iPhone | Tagged , , , | 1 Comment

Programmers rant: Converting development religion, what I’m doing

131 days since I blogged, happened lots of things in development world, learned a lot, engaged with open source platforms, generated some ideas and converted my development religion. I will be documenting my last 5 months in no specific order. I start learning software/web application development in windows platform. My first language was PHP(strange right?) when I was in school. Never really attracted to desktop softwares, always a big fan of minimalistic approach of solving problems and softwares. I am familiar with linux OS from Ubuntu 4.10 (Warty Warthog). My uncle was backdated and windows fan so he was using win 98 and my friend’s father computer was win 95 so I only got chances of using ubuntu in my teacher’s house. Difficult days those were in terms of using a pc with linux. My mom used to say don’t sit longer in-front of PC/TV, your eyes will be spoiled. When I got my own pc at the age of 13 I guess, I was using win 98. I grab the first chance of using Warthog from one of my mentor and installed it on my computer that was *hard* I spent the whole night screwing up my system. After that lots of things changed, I used ubuntu occasionally after my school. Win xp was nice and got addicted using the system, only thing I hated in windows was ie6.

I always had a linux distribution as a second OS in my laptop or pc. Moved on with life, study, going abroad, being lonely, making life super complex a lot has happened. Started coding again three years back. Learned the basic js, css, html and improve my php skills. Got a job here(where I’m now) in a startup working with cakePHP. Had good time with some nice and geek people learning ajax and baking code. Joined integricity and I was still coding in windows platform. I always blamed Microsoft for being so stupid but still developing on their platform and that kinda s****. Its more than 1 year now I am using linux, specifically Ubuntu distribution of linux and now I can say proudly ‘Hate Microsoft Windows’. Started using ubuntu in the office as well. Learned every possible thing that I will need to work on office, converted my platform based development religion from windows to ubuntu. I know I have long way to go to be a master in linux platform, I know I have 10 times better skill in windows than in linux but I’m really happy to ditch the windows.

Some interesting projects I engaged with in last few months, the reason I was busy:

  • Chrome web Store: Hopefully I’ll be able to push one of my apps into the store sooooon. Can’t promise how soon it will be though *lazy excuse*.
  • iPhone app development: I’m in the midst of crafting an iPhone app *happy*. yeah, you heard that right I’m learning objective-c.
  • Django project: I’ve created a django project in my local but still going through some difficulties with some remaining task. Yeah I learned python months ago and practicing it by creating a django app.
  • JS visualization project: I am just planning, no improvement yet for the idea. but I will be creating a data visualization web app.
  • Facebook API: Recently facebook changes their API, launch new GRAPH API. I had fun learning it and still there are some tabs in my browser are dedicated to facebook API documentation
  • Lunch App: Yes, a super cool HTML5 project that I’m working on right now with @seanx2 and @zilch. I researched for appropriate backend to work with this app. I considered node, php, python for this project while researching I learned a lot.
  • HTML5: I built lunch app using local storage of html5. I am considering using offline, local storage and geo location in version 2 of my app.
  • NoSQL: I considered learning NoSQL few days back and tried out mongo db but well couldn’t carry the interest to work on it further. Probably in near future?
  • Development Talks: I will be giving a talk in my company about Facebook Insights, preparing some other development talks as well.
  • Some of the projects are still ongoing and I’m working hard to get some results from those projects.

Tools that I am using for my day to day development:

  • Vim: Awesome editor for unix systems.
  • gedit: I like it, not bad
  • Git: I am in love with git
  • SVN: Still have to use it in an era of git :(
  • iPhone SDK: Developing iPhone apps
  • Hotot: Can’t think of developing anything without tweeting, an awesome python goodness
  • Terminal: Can’t think of doing anything in my OS without terminal
  • and lots of other tools.

Where I pass most of my times:

  • Hacker News: Awesome place for the awesome stuff, and recent major happenings in the world of web development.
  • Quora: I love to see what developers are doing and thinking
  • Apple developers blog: Just like a novice iPhone app developer :P
  • Twitter: I follow some awesome open source developers, and they inspire me when they talk as human and share the next big thing of web.
  • HTML whatwg Docs: I like it here.
  • Github: Why not sharing open source code and forking them to be a part of the next big thing?

Interesting Happenings: I turned down a opportunity working with a startup few days back although they offered me almost double the opportunities I’m getting now. I would have get to work in a new environment and with some cool ideas but what I didn’t like about the company was they aren’t fun. They are serious about making employee work HARD. what I learned from integricity is when you work something from your heart you will succeeded, and integricity is a company where you can work in a fun environment from your heart. I wake up in the morning and think of what cool thing will happen today in the office, what I’ll learn and how can I improve my skills. I enjoy staying in the office instead of going to university for boring classes. I try to improve my skills every single day, try to learn new things and have a chance of implementing it with various projects that I work on @integricity. I love what I do here.

Posted in Personal, status | Tagged , | Leave a comment

Learning git: Part 2

As a part of learning basic and introductory git tutorial, in this part we will be learning some basic stuff about git. It is recommended to read the first part before diving into this part of the tutorial.

Branching: Branching is one of the strongest feature of git. It is very easy to branch of git repositories and work with them. If we want to create a new feature but do not want to merge them with the main repo yet then branching will come handy and very useful. A single git repository can maintain multiple branches of development. To create a new branch named “updateClass”, use

$ git branch updateClass

before you create any branch you might want to check how many branches are there, if you want to check the branches you simply execute the code below there it will show you your branches and (*) aster-stick marked branch indicates that you currently on this branch.

$ git branch

To change the branch of your choice you can execute this code in your terminal.

$ git checkout updateClass
#you can use $git checkout branchname

you can add, commit your new files in this branch what won’t be seen in the master branch if you don’t merge it with master branch of your repository. Since we learned branching we should learn how to visualize branching as well. Here comes the interesting part of git GUI. I f we want to see the branching and log, updates, commits and all those thing we can execute the command given below to see the git GUI goodness of branching.

$ gitk

It will bring you the GUI of branching an you can check the commits and updates of that particular branch, you may be wondering why you are not seeing all the commits of your repository. Actually you won’t see the commit of other branches unless you use the below command in your terminal.

$ gitk --all

What it does is open a branching git GUI with all commits and updates of all branches. `–all` here is working like a flag, by executing this flag we are asking the terminal to show us the all commits and updates of all branches. We can use the same flag for seeing the log also. For example:

$ git log --all

This command will give us all the information about commits and if you want to see the tree view of your commits you might want to try this which will give you a tree view of your all commits.

$ git log --graph --all --oneline

Now it is time to merge our whatever changes that we made in our branch and want to merge it with master branch. For merging with master brunch we can use the code below:

$ git merge updateClass #assuming I am in master branch

If there is no conflict then you are done merging your new idea with you main program. If there are conflicts, markers will be left in the problematic files showing the conflict. After successfully merging the branch data with master you may want to delete the branch, if you want to delete the branch you need to execute the code below:

$ git branch -d updateClass

This command ensures that the changes in the experimental branch are already in the current branch.
Something to take note, your commit will fail if there is any conflict with your merge, if it is so then you can edit the conflict file , add and commit the file again should solve the problem. If you want to undo a marge then those code below will help,If you get stuck and decide to just give up and throw the whole mess away, you can always return to the pre-merge state with:

$ git reset --hard HEAD

Or, if you’ve already committed the merge that you want to throw away,

$ git reset --hard ORIG_HEAD

Just to take note: Never throw away a commit if that commit may itself have been merged into another branch because it can creates confuse further merges.

Tagging: Tagging is like giving version no to your current project or repository. It is also very easy to tag a project in git, obviously we will be using:

$ git tag

If you have any version tagged to your project then after executing this you will see your own version no or whatever you assigned to your project as tag. If you want to assign a tag to your project you can execute and assign it like this:

$ git tag v1.0.199

You also can tag like this:

$ git tag -a stable-1

If you want to add a message with your tag you can use the -m flag:

$ git tag -a stable-1 -m 'this is the stable version'

Interesting art of tag is you can see the information about a tag by running the `git show` command like this:

$ git show v1.0.199

Try executing `git describe` comment to see the extra information of the tag.

$ git describe

happy gitting as always!

Posted in Programming, git101 | Tagged , , , | 1 Comment

Learning git: Part 1

I was learning git for couple of months now but I am still couldn’t master the art of using git, Although I was using sub version for years. There are lots of difference between git and other subversions namely tortoise svn. I am a big fan of version controlling and obviously my first choice and I am still using tortoise svn but git attracted me by its powerful system of version controlling. I will be documenting what I learned for past few months and the basic art of using git. I hope you will have fun using git. I won’t be documenting how to install git either in windows or in *nix but I will be attaching some link where they stated beautifully how to install git in your operating system. Basically git is a command line system of version control so before you jump into this you need to know at least the basic of command line and terminal. If you are using windows like me and wanted to give git a chance then head over here to get the information how to install msysgit what is basically the tools you need for using git in windows. This project is hosted in google and basically running and improving by some awesome volunteer so if you want to help msysgit just be a volunteer.

Lets move to the main part. Assuming you have installed msysgit on your windows we will learn in this part of learning git, how to configure our git repositories, how to commit, add and see the log and status. If we can finish learning quickly then we will be learning branching in our second part of learning git. You have to configure git after you install msysgit on windows so that it will know who you are.
Configuring Git:Open up the terminal what came with msysgit not our native terminal of our windows. I think you shouldn’t be closing this terminal while you will be working on git because as I said git is basically the command line system. After you open your terminal execute those lines:

$ git config --global user.name “Maz Anwar”
$ git config --global user.email “maz@protishobdo.com”

Obviously you have to change name and email address in the double quoted area where now I have putted mine. Well, congrats! you have configured your git, now we will learn using git.
Using Git: First step of using git is setting up your git repository. Create a repository where you want to keep your files, move in to that folder in your terminal. Assuming you know how to change directory in your terminal, in case you don’t know how to do that use `CD`, which means change directory, and the directory that you just created for your project. Lets assume you have created a folder called test in your (D) drive and you are in root in your terminal so you probably want to use a code similar to this:

cd D:/test

Once we are in the repository of our project then its incredibly simple to initialize git for that repository. execute this code by staying in the repository you have created for your project:

git init

Once you execute this command your response in the terminal would be like this except the file path and folder name:

$ git init
Initialized empty Git repository in D:/test/.git/

Now we will be learning about git status, how it works and why you need it. This is very important and useful command both for beginners and proficient. Let’s say we have three files in our project folder.
1.default.css
2.index.html
3.readme.txt
Now if we run `git status` command in the terminal we will be getting the status of our folder and files. Result in the terminal will be looking like this(kind of):

$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
# (use “git add <file>...” to include in what will be
committed)
#
# readme.txt
# default.css
# index.html
nothing added to commit but untracked files present (use
“git add” to track)

The first line tells you that you are on the master branch.The next line—initial commit—is a reminder that we have not committed anything to our new git repository. Next we have a list of untracked files. Note that all three of the files we have in our directory are correctly listed as untracked.

Git Add: we will be using this command to add the file in version control system, to add any file which will be ‘trackable’ by git execute the `git add` command and the file name, like this:

$ git add index.html default.css

After adding the file you should check back the status of your repository by executing `git status` to see whether the file that are added on the git is tracked or not. If we see something like this then our adding is wokring and we will be moving on to next step:

$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
# (use “git rm --cached <file>...” to unstage)
#
# new file: default.css
# new file: index.html
#
# Untracked files:
# (use “git add <file>...” to include in what will be

Git Commit: The primary purpose of source code management systems is to keep a snapshot record of your project as it grows up. the simplest way to commit is executing this line in the terminal.

git commit

This will take you to your command line’s default editor and will be asking you to put a short message which is very important to keep track of the committed reason and files and what was committed. It will be working as a change-log as well. After entering your message save the file and exit from the editor. To exit from the editor first press `Esc` key on your keyboard and then `:exit`, should be taking you to the commit confirmation code in your terminal and will close the editor inside the terminal. Once you close the editor you should see these kind of confirmation lines in your terminal:

[master (root-commit) 3435356] initial commit
3 files changed, 10 insertions(+), 0 deletions(-)
create mode 100644 README
create mode 100644 default.css
create mode 100644 index.html

Git Log:This command is very handy to see the log of a committing repository. This is very handy to keep track of users and the project as well. To see the log execute this command:

git log

After executing the command result in my terminal was:

Thanks for reading the post and hope you found interest in git, all the best in your gitting(I invented the word? :P )

Posted in Programming, git101 | Tagged , , | 2 Comments

jQuery 101, Part 1 : Objects and Functions

1. Objects: According to Rebecca Murphey “nearly everything in JavaScript is an object — arrays, functions, numbers, even strings — and they all have properties and methods.” objects are key value pairs. It can hold one or more values, these values can be any type of value: a string, numbers, functions or even another object and they have methods and properties.

var testObject = {
    sayHello : function() {
        console.log('hello');
    },

    testName : 'Maz'
};

testObject .sayHello();            // logs 'hello'
console.log(testObject .testName);   // logs 'Maz'

2. Fuctions: Functions are the `first class citizens` in jQuery. Functions are block of codes. Here `testVariable ` is an object holding a function called test() as its value.

function test(){/*do somthing */}

var testVariable = function test(){/*do something*/}

2.1 Using Functions: jQuery is all about `less coding do more thing and re use of code` as a result you will be using a lots of functions when you will use jQuery. Below I have documented different ways of using functions.

var sayHello= function(person, greeting) {
    var text = greeting + ', ' + person;
    console.log(text);
};

sayHello('Maz', 'Hello'); // logs 'Hello,Maz'

2.1.2 Function that returns a value:

var sayHello= function(person, greeting) {
    var text = greeting + ', ' + person;
    return text;
};

console.log(sayHello('Maz', 'Hello')); // logs 'Hello,Maz'

2.1.3 Function that returns another function:

var sayHello= function(person, greeting) {
    var text = greeting + ', ' + person;
    return function() { console.log(text); };
};

var greeting = sayHello('Maz', 'Hello');
greeting();

2.1.4 Functions as Argument:

2.1.4.1 Passing an anonymous function as argument:

var testFn = function(fn) {
    var result = fn();
    console.log(result);
};

testFn (function() { return 'hello world'; });   // logs 'hello world'

2.1.4.2 Passing a named function as an argument:

var testFn = function(fn) {
    var result = fn();
    console.log(result);
};

var testOtherFn = function() {
    return 'hello world';
};

testFn(testOtherFn);   // logs 'hello world'

2.1.4.3 Self executing function: creates a function expression and then immediately executes the function. This pattern is extremely useful for cases where you want to avoid polluting the global namespace with your code — no variables declared inside of the function are visible outside of it

(function($){
var text = "fake text";
})();

Creating our own functions in jQuery:
Define “jQuery.fn” and add to this object your function name (jQuery.fn is a prototype of jQuery object).

jQuery.fn.changeAinDiv = function() {
  return this.each(function() {
    if (this.host != window.location.host) {
      $(this).attr('title', 'Not a link that is hosted here');
    }
  });
};

Usage of the function that we created just now:

$(document).ready(function(){
$("#divName a").changeAinDiv();
});
Posted in Programming, jQuery101 | Tagged , , , , , , | 3 Comments

Configuring your wifi, headphone for Ubuntu 10.04 LTS in lenovo ideapad v460

As a linux fan boy I always try to play with different version of unix system and I heart ubuntu of them all. Recently I bought a lenovo ideapad v460 what came with windows 7 by default. I had ubuntu 10.04 LTS and since it is very easy to setup a linux system so gave an installation. Previously I didn’t have to face any problem like detecting hardware, or configuring anything in the system. But after installing ubuntu 10.04 in my laptop I faced some really stupid problem what I came to know some of them were actually bug of linux later. After the installation my wifi wasn’t working. I used the wired connection and re-install package as I had the package installed but for some reason it was not working. If you are wondering which package I am talking about, the package was ‘bcmwl-modaliases’ . Check it on your synatic package manager whether you have it installed or not. If you have the package then just mark for reinstall it by right clicking on the package in synaptic package manager or if you do not have the package installed ten open you terminal and with root privileges try these line of code to install it and then reboot your system, code:

sudo apt-get install bcmwl-modaliases

You will find the full bug report here>> https://bugs.launchpad.net/ubuntu/+bug/511379

If your headphone is not working then there is solution too for this problem. This problem occurred due to not updated alsa driver. ubuntu 10.04 LTS(lucid) comes with alsa-driver-1.0.20 version but you need alsa-driver-1.0.23 to make your headphone work. If you are a noob and looking for codes to update your alsa driver, this snippet of codes below might help you solve the problem, code:

sudo apt-get install build-essential linux-headers-$(uname -r)

wget ftp://ftp.alsa-project.org/pub/driver/alsa-driver-1.0.23.tar.bz2

tar -xjf alsa-driver-1.0.23.tar.bz2

cd alsa-driver-1.0.23

./configure

sudo make

sudo make install

If you already have the build essential then no need to execute the first line of the code snippet. If you want to understand the code, first line was for the pachage build-essential. Second line to get the alsa-driver-1.0.23 driver which is compressed. Third line is to extract the file that you just downloaded. Rest steps are the basic to setup a program in linux. After successfully setting up the alsa-driver updated version reboot your computer and that should be it. Your headphone should be working. Check out this forum post for more details information. Happy hacking and debugging :)

Posted in Troubleshooting | Tagged , , , | 2 Comments

Facebook old REST API and cURL Exception error

Few days back I was working on a facebook game development project. While developing and designing the code architecture for the application I was using my own server. It was working fine but when I port over it to new server the code was not working instead it was giving me cURL Exception error. Exactly the error was

Fatal error: Uncaught CurlException: 6: name lookup timed out thrown in /home/****/public_html/{myfolder}/facebook.php on line 589

I was wondering for an hour but didn’t find any solution. I was using old REST API to to execute and get the information from facebook using

fql.query

If you are wondering my code was

$fql = "";//my_query
$_friends = $facebook->api(array('query'=>$fql, 'method'=>'fql.query'));

I tried the new graph api to invoke the fql.query method to overcome the problem and I succeeded. The code that work for me instead of using old REST API was,

$fql = "";//my_query
$_friends = json_decode(file_get_contents("https://api.facebook.com/method/fql.query?query=".urlencode($fql)."&access_token=".$facebook->getAccessToken()."&format=json"));

But I was wondering what can be the problem since the same code is working for my another server. The reason I was getting the cURL exception error was this variable in facebook.php class.

CURLOPT_CONNECTTIMEOUT=>10;

If I increase the value to 40 or so then same code works without giving any exception error. I guess it is because my new server is slow and it can’t execute within 10 sec? I would love to hear an explanation if you have any regarding this matter. Happy coding!

Posted in Programming | Tagged , , , , , , , | 4 Comments

Create a google chrome extension for your blog.

I am a big fan of google chrome. Not because it is fast and you can search directly from your address bar but for it’s minimalistic design. I will describe in this post how we can create an extension for our own blog. This tutorial will be helpful for the beginners of chrome extension developers.
We are using lots of extensions in our chrome browser to simplify our task in the web like one click email checking, tweeting, url shortener and so on. Say we have our blogs and we have our readers, what about creating an extension for them where they will be able to see the latest posts of the blog using one simple extension?

Lets get started with code. There are three basic steps in order to create your extension. We will be using feed burner feed of our blog, we will code our extension and submit it to google hosting. Assuming we all know how to create a BuzzBoost in feed burner for our feed. First we will grab the script from BuzzBoost what will look like :

<script src="http://feeds.feedburner.com/{your feed url}/add-ons?format=sigpro" type="text/javascript" ></script>

Lets move on to main thing, coding our extension. Creating and loading our extension is also easy. We will be creating two file:
1.manifest.json
2.popup.html
manifest.json file will hold our extension info whereas popup.html file will be our main processing file for the extension. Create one folder inside your computer and name it whatever you want. Create a manifest .json file and put these codes:

{
  "name": "Protishobdo",
  "version": "1.0",
  "description": "Latest blog post feeds of Protishobdo",
  "browser_action": {
    "default_icon": "favicon.jpg",
	"popup": "popup.html"
  }
}

Those information are basic things, obviously those informations are for my blog so feel free to change it according to your blog or however you want. popup is the variable for holding the main page of your extension. default_icon is the icon image that will show up in the chrome browser. After we creating our anifest.json file lets move on to next file popup.html. After creating a blank html file called popup.html dump this code into your file.

<div id="my-blog">{script we got from feed burner at the beginning of the post}</div>

Insert you script that you got from feed burner BuzzBoost earlier in side the div, save the file and it is time to run our code as an extension locally.

Go to your chrome browser’s extension page. You need to use the developer channel of google chrome. Look for developer mode open it if it is not open already, just to click on the [+] button will block a new div where you will be able to see three button where on button is called “Load unpacked extension”. Click on it and locate the folder in your computer what you created to keep all your new created extension files. Before loading the folder make sure you have already placed favicon.jpg file in that folder. After loading the folder you will see your icon will appear in the chrome browser, click on it and you will be able to see one popup showing the blog contents. Now to make it look nicer add some css on the page. If you want to do something just do it in the popup.html page and you also can add an extra library in your extension. Just copy the file you want to use in the same folder link it to popup.html page and reload the extension from your extension page. That should be doing the magic. We already created an extension for chrome featuring our blog, now what? In order to host the extension in the cloud you can either host it on your server or you can host it to google. Go to this page for brief about hosting. Something important to remember:
1. When you update your extension make sure you updated the manifest.json file with version number. version number should be greater than the previous one.
2. Make sure you have the google chrome developer release or beta release.

For more in-depth documentation, check here.

Don’t forget to install my extension for this blog what you will find here. Have fun and happy extension building day :P

Posted in Programming | Tagged , , | 1 Comment

Welcoming FIFA 2010 World cup with Facebook App

A big ceremony, lots of people will be watching TV from every corner of the world, a festival time for all regardless of religion, ethnicity or culture. It has its own culture, it binds people with love. I am a die hard fan of world cup football.

This year to celebrate football world cup, I created an facebook App to keep all the statistics of every single game and to show back to the user even after the world cup. Voting system for favourite team and player is another part of this application beside an archive of past world cup with a single image of that world cup and some really interesting info. Sadekur Rahman, who helped me with all the info collecting, database entry and with his valuable ideas another developer of this application. We went live just before 8 days of world cup opening match. People were interested about our application as well. Thanks to all the users of our application and people who always helped me to do something. Check the application and give me feedback. Here is our Application Fan Page.

Since it is open source development so there is no sponsor at the moment but we will love to have one. Do email me if you are interested, or donate us through the donate button on your left!

Posted in Programming | 1 Comment