MIT’s Robot can jump over hurdles : Cheetah robot

MIT’s Robot can jump over hurdles : Cheetah robot

Human’s can achieve anything, human mind is the greatest gift of god. If you run in hurry or if you run on a moving floor your mind will get confused and some times you fell down. If you are not practiced then you can’t even cross two three hurdles continuously, you will fell down. Have you ever wondered a robot can do this ? it is so difficult to program even a simplest automation or even a simplest robot which can just move by itself. Now we have everything ready made so you may say it is not so difficult, but Cheetha which can run and jump over the hurdles ? really challenging.

A MIT’s Cheetah Robotic TEAM

Deborah Ajilo, Negin Abdolrahim Poorheravi,John Patrick Mayo,Justin Cheung, Sangbae Kim, Shinsuk Park, Kathryn L. Evans, and Matt Angle.  Will Bosworth, Joao Luiz Almeida Souza Ramos, Sehyuk Yim, Albert Wang, Meng Yee Chuah, and Hae Won Park.

Algorithm Behind MIT’s Cheetha robot :

The bounding algorithm which made this possible will program each of the robot’s legs to exert a certain amount of force in the split second during which it hits the ground, in order to maintain a given speed: In general, the faster the desired speed, the more force must be applied to propel the robot forward.

the cheetaha robot adopts the force as per the surface and hence it successfully passed the test in grassy area and treadmill.Robot can run 16 km/h, jump about 40 centimetres high, land safely and continue running for at least 15 minutes .

Technical Details of MIT’s Bounding Algorithm and Robotic Cheetah

It took more than 5 years to achieve this and Cheetah 2 contains the custom electric motor designed by Jeffrey Lang, the Vitesse Professor of Electrical Engineering at MIT and the amplifier designed by David Otten, a principal research engineer in MIT’s Research Laboratory of Electronics. 

“bounding algorithm” calculates the varying amounts of force required to propel an animal forward or to jump over obstacles. Algorithm models the running mechanics of world-class sprinters like Olympian Usain Bolt: the faster the desired speed, the greater the force the legs exert.

This robotic cheetah carries out its movements with the help of battery powered electric motors which do not make much noise even.  Though the US-military has been trying for several years to make a stealthy and fast robot, it hadn’t been successful until now so this DARPA funded research by the MIT researchers may just open a whole new vision regarding the making of a stealthier bot.


What is Yoga – Yoga

What Is Yoga – A Definition by Patanjali 

Patanjali describes Yoga as ‘ Chitta vrtti nirodhah’, it is translated as suppression (nirodhah) of the fluctuations(vrtti) of consciousness (chitta). Chitta denotes that the mind in its total or collective sense and it is composed of three important categories.

a) Mind – Manas, that is the power and faculty of attention, selection and rejection.

b) Intelligence or Reason –  Buddhi, that is the decisive state which determines the distinction between things

c) Ego – (ahamkara, literally the I maker ).

The driving force for a human life is ‘ I ‘ factor, I know , I made. Without the self there is no life, but the I factor should not grow within you we should try to suppress it as much as possible to make the life beautiful.


Yoga is the method by which the restless mind is calmed and the energy directed into constructive channels. Shri Krishna in Bhagavad Gita sixth chapter, describes yoga to Arjuna as – The meaning of Yoga as a deliverance from contact within pain and sorrow. ‘ When the mind, intellect and self (ahamkara) are under control, freed from restless desire, so that they rest within yourself, a man become Yukta – one in communion with God.

The Stages of Yoga

Patanjali enumerates eight limbs of Yoga.

1. Yama – Universal Moral Commandments

2. Niyama – Purification of self through discipline 

3. Asana – Posture

4. Pranayama – Rhythmic control of the breath

5. Pratyahara – Withdrawal from the domination of the senses and exterior objects

6. Dharana – Concentration

7. Dyaana – Meditation

8. Samadhi – A state of super consciousness brought about by profound meditation.

Yama and Niyama control the yogi’s passion and emotions. Asanas keep the body healthy and strong. Finally the yogi becomes free of body consciousness.

Pranayama and Pratyahar, teach the aspirant to regulate the breathing and their by control the mind. This helps to free the senses from the objects of desire.

Dharana, Dhyana and Samadhi take the yogi a state of super consciousness brought about by profound meditation.

Also Read

Interesting Facts to know about Ancient India

Some Interesting Facts to know about Ancient India

The whole world knew that India is the mother of many inventions. We all knew many facts which are very common like Aryabhata calculated that 1,582,237,500 rotations of the Earth equal 57,753,336 lunar orbits. This is an extremely accurate ratio of a fundamental astronomical ratio (1,582,237,500/57,753,336 = 27.3964693572), and is perhaps the oldest astronomical constant calculated to such accuracy.

We come across many such facts but there are few facts which many of us don’t know. So I would like to highlight two such facts.

History of Discovery of Airoplane in Ancient India –

Many of us doesn’t know that Indians invented the airoplane, A person called Shivkar Bapuji Talpade an Indian, made plane in 1895 Near Mumbai. Unbelievably without pilot the plane was working with remote control and flying at 1500 feet successfully.

Great vimaan shaastranjya of India was Maharshi Bharadwaj. Maharshi vrushi  Written a book Vaimaanika shaastra on Vimaan shaastra. Plane were capable to fly based on a free energy technic called anti – gravity Shivkar Bapuji Talpade referred those books. The book explains 500 siddhant (tareeke, techniques) to make a plane.

Read more about it –

Discovery of Atomic Bomb : Based on Ancient Indian Text

It is documented that Americans didn’t made their nuclear weapon on their own, they have no such technology and knowledge of making nuclear weapon. It is documented that USA did first ever nuclear weapon with the help of German scientists who translated one of the Ancient Indian Text.

Reference –

Albert Einstein said: We owe a lot to the Indians (Hindus), Who taught us how to count, without which no worthwhile scientific discovery could have been made.

Ancient Indians introduced Devanagari Language, which is the first ever language documented in the history. Later we introduced Sanskrit, Sanskrit is the mother of all the European languages.

The World’s first university was established in Takshila in700BC. More than 10,500 students from all over the world studied more than 60 subjects. Ancient Indians adopted monitorial education system. The University of Nalanda built in the 4th century BC was one of the greatest achievements of ancient India in the field of education. 

Sanskrit Language: The Most Scientific, Ancient, Spiritual 

Also read –

Also read –

Android: ItemClickListner with CheckBox or RadioButton.

Android: ItemClickListner with CheckBox or RadioButton.

Lets take a scenario to understand the need of a listview which will have checkbox embedded in it.

Consider the flipkart mobile app, in that we want to compare 2 or more products, in order to do that I will go on selecting the items which I want to compare and then click on the compare button.


So we have multiple items in that and hence we cant use the android built in types for creating the list view. Hence we need to follow the below mentioned approach.


  1. Create an activity, which contains 2 listviews, one listview for displaying all available mobiles and another listview for displaying selected mobiles.
  2. Create an adapter for filling the mobile list for the above mentioned listviews.
  3. The layout which will be used for creating row which will make ItemClickListner work is as follows,


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android=""
    android:orientation="vertical" android:layout_width="match_parent"





Observe the following attributes for Checkbox,


These make the checkbox non clickable and eventually the event will be transferred to its parent i.e the row and hence the ItemClickListner will be invoked.

You can download the files here

Circle drawing and filling arc in android

Circle drawing and filling arc in android

It is always a fun to play with mathematics, everything in this world is happening because mathematics. Mathematics is everywhere, every moment. Computers, physics, chemistry, biology every area is just standing upon Math.

Being an enthusiastic developer I always love to play with mathematics, so here is an example which draws a circle and a filling arc within the circle. Definitely you will get a the code in many web sites if you just google. But i would like to explain the math that plays an important role to achieve this.

The result should look as follow.



Let me divide the code in three sections.

Section 1 : Drawing a circle

How to draw a circle in android using Canvas and Paint ?

Code :


        int screenWidth = 420;  //Give your device screen width here 
        int horizontalCentreX = screenWidth/2;
        int circleCentrex = horizontalCentreX;
        int circleCentreY = 150;
        int radius = 130;
        int arcStartingAngle = 270;
        int minutes = 15;
        int seconds = 60;
        int minsToSecondsConverionFactor= minutes * seconds; //just to fill the circle for 15 mins
        int arcRectStartingX = circleCentrex - radius;
        int arcRectStartingY = 20;
        int arcRectEndingX = circleCentrex + radius;
        int arcRectEndingY = 280;

       //Just create a bit map of size (width = screen width, height = depends on how big circle you want
         Bitmap b = Bitmap.createBitmap(screenWidth, 300, Bitmap.Config.ARGB_8888);

        Paint paint = new Paint();
        Canvas canvas = new Canvas(b);
        paint.setColor(Color.rgb(62, 176, 220));
        canvas.drawCircle(circleCentrex, circleCentreY, radius, paint);

Section 2 : Drawing an Arc

So How to draw a filling arc in android using Canvas and Paint ?

Code :

   paint.setColor(Color.rgb(250, 64, 129));
        final RectF oval = new RectF();
        oval.set(arcRectStartingX, arcRectStartingY, arcRectEndingX, arcRectEndingY);
        canvas.drawArc(oval, arcStartingAngle, ((i * 360) / minsToSecondsConverionFactor), false, paint);

Section 3 : Drawing a Point at the end of the filling arc

Here is the trick, to calculate the end point in the filling arc, we need to apply Trigonometry. Let me explain this in steps.

Observe the figure given below,



The figure shows Circle drawn at the centre point(CenterX,CenterY) . We have have an arc which will be continuously drawn and the arc fills the circle in the direction as shown in the figure. So our job is to find out the point(x,y) and the end of the arc.

If you observe a triangle drawn with Centre of the circle and point over the arc, it will be a right angled triangle.

So by applying trigonometry

  cos(θ) = adjacent / hypotenuse
         = adjacent / radius ( because radius == hypotenuse)
  adjacent = cos(θ) * radius
       x   = cos(θ) * radius ( this is because point (x,y) is nothing but point is X distance (along X-Axis) aways from Centre and Y distance away (along Y-Axis).

 sin(θ) = opposite / hypotenuse
        = opposite / radius
      y = sin(θ) * radius ( this is because point (x,y) is nothing but point is X distance (along X-Axis) aways from Centre and Y distance away (along Y-Axis).

But the values we got x and y are from the centre but the centre is centreX distance aways from the left side of the screen and centreY distance away from the top side of the screen.

Hence point x on the arc must be = centreX + x distance aways from Left side of the screen
                                 = centreX + cos(θ) * radius

Hence point y on the arc must be = centreY + y distance aways from Left side of the screen
                                 = centreY + sin(θ) * radius

If you debug and observe the y value we get will increase initially and start decreasing, this depends upon the angle, angle less than or equal to 90deg will be give +ve value for cos(θ) and angle greater than 90deg will give -ve value.

Hence the above calculation always gives you end point of the filling arc along the circumference of the circle.



Animation and The Role of GPU – A Performance factor

Animation and The Role of GPU – A Performance factor

Just take a look into the given CSS which rotates your div by 360deg

<span style="color: #993366;">.box_rotate {
 -webkit-transform: rotate(360deg); 
 -moz-transform: rotate(360deg); 
 -ms-transform: rotate(360deg); 
 -o-transform: rotate(360deg); 
 transform: rotate(360deg);

Code Example – JSFiddle

Have you ever wondered what happens in your computer when we see even a simple animation?

Your computer algorithm calculates every pixel and performs CPU intensive operation over each pixel. Ok what such operations it does ?. It calculates every pixel and performs Discrete Fourier Transformation on each pixel of the image. If your image is 512X512  = 2,62,144 pixels and the algorithms operates several frames per second, like 50 frames per second which depends upon the type of hardware/algorithm being used. It operates every pixel several times per second ( like every pixel 60 times per second ) now image for an image with size 512X512 = 2,62,144pixels and each pixel operated 60 times per second this gives you unbelievably huge number.

Assume that you operated only 1 second,

2,62,144 * 60 = 1,57,28,640 times and these many times it is not just a simple operation, they may apply Fourier transformation on each pixel. 

Another important factor to note that the Image rotation, Image scaling or any graphics related operations the the matrix calculations will come into picture. The rotation matrix and the image matrix will be multiplied to get the resulting image

rotation matrix

rotation matrix

An image matrix will be a huge one, like 512 x 512 x 3 for a given 512X512 image. the 3 in matrix indicates image is RGB coloured. It is not required to explain how matrix multiplications are CPU extensive, Theoretically, matrix-matrix multiplication uses O(N^3) operations on O(N^2) data

Comparison of GPU Matrix Multiplication operation over CPU

Why GPU and Why not CPU.

GPU are specifically made for performing graphics operations like moving pixels and applying transforms. Since CPU will be doing many more tasks like file operations, audio, calculations etc it is better to separate out your animated objects and give it to a different GPU layer. Imagine in the screen of 1024X800, somewhere some 200X100 size portion is animating, rather than giving 1024X800 space and find 200×100 space and then operate , it is nice trick to create separate layer of 200×100 space and perform animation independently in that layer.

So the load on your CPU will be reduced and the performance of the system will be improved. The difference between CSS3 and jquery animations are , CSS3 utilises GPU but jquery doesn’t, there another javascript based latest framework available called GSAP which is 20x faster than query. 


Comparison of jquery, CSS and GSAP Animation Performance :

Check our another article – how-to-make-you-web-site-faster-html-javascript-tricks

Reference :

Ancient Indian Education System

Ancient Indian Education System

The history is awesome every Indian will feel proud if we look back to our history and the future is definitely bright , today we may not be super power nation in the world but the future is definitely will change because the roots are very strong and deep. India is the land where several greatest innovations happened several hundreds of years ago.

We knew mathematics, we derived theorems, we discovered planets, we calculated distance of sun to earth thousands of years ago and also distance between earth and many other planets, yeah many more such facts and figures are there. But how could India was so great? How it was possible to gain such knowledge? The research reveals that our solid education system was the reason for that.

Ancient Education system was a meaningful education system; the idea of education has been very grand, noble and high in ancient India. It aim was “training for completeness of life” and the molding of character of men and women for the battle of life. As quoted by Swami Vivekananda education was for “Man Making and Character Building”. But what were the methodologies of that education? What was so different about it?

Below are few of methodologies of that great education system

Complete Brahmacharya:

Students use to leave their home and stay with Guru in Gurukul until they complete their education. It was like students follow complete Brahmacharya for 18 years until they study all the courses. Students strictly do Yoga every day which was essential for healthy mind and body, Yoga was compulsory for students. Yoga is an effective practice which will develop overall personality of a human. The purpose of yoga was the self realization and ancient Indians had identified that the supreme goal of human life is self realization. Yoga will bring mind into control and those who can control mind can achieve anything.

A student will initiate his Brahmacharya phase through Upanayana. A student will be self discipline and self controlled. All sort of pleasure will be avoided and he must do all the work given by a Guru.

Learning of Vedas:

Vedas plays an important role in ancient education system, there are four vedas. Rigveda contains 1028 hymns and contains 10,522 verses. It teaches stages of life like family life, forest life and renunciation. Yajurveda teaches how to perform sacrifices in life and it has 1,984 verses. Samaveda is study of music, it has 1,875 verses. Atharvaveda is the study of medical sciences and has 5,977 verses.

Vedas teach our culture, the meaning of life, how we should live, what is right and what is wrong. Ultimately it is learning of Karma, learning of dedication. Vedas are the roots of Hindu Religion.

Learning phases in Ancient Indian Education System:

Every student would undergo three phases every day. Every phase has its own importance, though they look simple but they are very effective.


Means listen and understand. One should understand that it is not just hearing, hearing is different and listening is different.


Is reflecting the things we listened (Shravana). It is discussing the truth of opinions. In this especially Guru will raise the questions, students will answer and the point will be discussed in group.


Complete comprehension by the student of the truth that is taught so that he may live the truth and not merely explain it by words. It is the realization of truth.

Adi shankaracharya wrote in 2000BC “Reflection (manana) is hundred times superior to listening (sravana);   meditation (nididhyasana) is hundred times superior to reflection;  nirvikalpaka samadhi is infinitely superior.”

Reference : Link

Also Read –

Arduino Android Interfacing – Example Code and Troubleshooting

Arduino Android Interfacing – Example Code and Troubleshooting


Mobile phones playing key role in our day to day life, when Google presented Android to the world and aimed to make every phones smart the mobile industry started growing and today even a low end mobile is a smart phone. In this smartphones era hardware interfacing and automation using smart phones is emerging.

The future is in Artificial intelligence, your smart phones are really becoming smart day by day. In this article we will see how to interface Arduino with Android Smart phone. We will divide this article into three sections

Arduino circuit diagram, Arduino code and Android code. 

How Arduino-Android interfacing using HC 05  Works ?

   After doing proper connections and both Android and HC 05 bluetooth module are paired. The android code will infinitely keep listening to incoming data from HC05 bluetooth module. When a button is pressed in which is connected to Arduino a data will be sent from HC05 to android. android code will read the incoming data.

Devices and Softwares needed :

  • HC – 05 Bluetooth module 
  • Arduino Uno R3
  • Breadboard and Jumper wires
  • Arduino IDE

Block diagram for Arduino-Android interfacing

block diagram Arduino-Android

block diagram Arduino-Android

Arduino Circuit Diagram –

Connection details : 

HC – 05 GND          ————>  Arduino GND Pin

HC – 05 VCC (5V)   ————> Arduino 5V

HC – 05 TX               ————>  Arduino Pin 10 ( soft RX )

HC – 05 RX               ————>  Arduino Pin 11 ( soft TX )

HC – 05 Key (Pin 34 ) ————>  Arduino Pin 9

Arduino Circuit diagram

Arduino Circuit diagram




Arduino Code :

SoftwareSerial mySerial(10,11); 
int button=9; 
int buttonState=0; 

void setup() {

void loop() {    
  buttonState=digitalRead(button); //Reads data when button is pressed      

 if (buttonState==LOW) {          
     mySerial.write("1"); //Send data 1 to Android.          

Android Code :

Declare necessary variables
/*Adapter helps to get a handler for device object which can be used to communicate with Bluetooth module*/
private BluetoothAdapter btAdapter = null;
/* Socket is used to connect and to get output/input streams to write/Read data To/From Bluetooth module */
 private BluetoothSocket btSocket = null;

/* Output stream used to send data to Bluetooth module
 private OutputStream outStream = null;

/* input stream used to read data from Bluetooth module */
 private InputStream inStream;

// UUID is used as a key to connect to the device
 private static final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");

// Insert your server's MAC address
 private static String address = "00:00:00:00:00:00";
protected void onCreate(Bundle savedInstanceState) {
      btAdapter = BluetoothAdapter.getDefaultAdapter();
       runnable = new Runnable() {
           public void run() { 
             //Create a thread which infinitely listen to the incoming data
       thread = new Thread(runnable);
 public void onResume() {
  // Set up a pointer to the remote node using it's address.
   BluetoothDevice device = btAdapter.getRemoteDevice(address);
 // Two things are needed to make a connection:
 //   A MAC address, which we got above.
 //   A Service ID or UUID.  In this case we are using the
 //     UUID for SPP.
   try {
      btSocket = device.createRfcommSocketToServiceRecord(MY_UUID);
    } catch (IOException e) {
        errorExit("Fatal Error", "In onResume() and socket create failed: " + e.getMessage() + ".");
  // Discovery is resource intensive.  Make sure it isn't going on
  // when you attempt to connect and pass your message.
  // Establish the connection.  This will block until it connects.
  try {
    } catch (IOException e) {
   try {
     } catch (IOException e2) {
// Create a data stream so we can talk to server.
 try {
     outStream = btSocket.getOutputStream();
     inStream = btSocket.getInputStream();
 } catch (IOException e) {
//Run listen in different thread
 public void listen() {
    // Keep listening to the InputStream until an exception occurs
    while (true) {
        try {
           // Read from the InputStream
           byte buffer[];
           buffer = new byte[1024];
           //Read is synchronous call which keeps on waiting until data is available
           int bytes =; 
            if(bytes &gt; 0){
              /*If data is non zero which means a data has been sent from Arduino to
               Android */
             //Do your stuff here
     } catch (IOException e) {
private void checkBTState() {
    // Check for Bluetooth support and then check to make sure it is turned on
    // Emulator doesn't support Bluetooth and will return null
    if (btAdapter == null) {
    } else {
private void sendData(String message) {
    byte[] msgBuffer = message.getBytes();
    try {
     } catch (IOException e) {
        String msg = "In onResume() and an exception occurred during write: " + e.getMessage();
     if (address.equals("00:00:00:00:00:00"))
             msg = msg + ".\n\nUpdate your server address from 00:00:00:00:00:00 to the correct address on line 37 in the java code";
        msg = msg + ".\n\nCheck that the SPP UUID: " + MY_UUID.toString() + " exists on server.\n\n";
         errorExit("Fatal Error", msg);

<span style="color: #ff0000;">App Manifest file :</span>
<span style="color: #000000;">Download Manifest file here :</span> <span style="text-decoration: underline;"><span style="color: #0000ff;"><a style="color: #0000ff; text-decoration: underline;" href="">Link


Troubleshooting Arduino HC 05:

There are many issues you might face and the troubleshooting techniques are as follows. 1. Some times Android and HC 05 will not connect ( android btSocket.connect();) might fail In this case unpair your HC 05 from android mobile and restart your Arduino(power off and power on). Pair again with android. If this doesn’t work then restart your mobile phone. 2. Some times android reads junk data even though data is not sent from HC 05. In this case also do the same stuff as described in above point. You can find many examples in –

Project done by :

1. Vidya

2. Savitri

3. Shabnam

4. Niharika

Basaveshwar Engineering College – Bagalkot

How To Make You Web Site Faster : HTML , Javascript Tricks

How To Make You Web Site Faster : HTML , Javascript Tricks


The performance of your web application is highly important factor to get more user visits, experts have given many advices to improve the performance of a web application and few are listed below.

1. Meta refreshMeta refresh is a method of instructing a web browser to automatically refresh the current web page or frame after a given time interval, using an HTML meta element with the http-equiv parameter set to “refresh” and a content parameter giving the time interval in seconds.

Avoid Meta refresh as much as possible. This will slow down your site.

2. @imports will synchronously load the style sheet, Avoiding @import will improve the performance of your site. Instead of @imports use LINK tag as follows

<link rel=’stylesheet’ href=’knowledge-cess-style.css’>

Than   <style> @import url(‘knowledge-cess-style.css’); </style>

3. Avoid use of multiple framework – Some people use JQuery for some functionality and DOJO for some functionality . Loading of framework will take time and your app becomes heavy. Stick to one framework.

4. Placing scripts at the end

Most people will load all their scripts at the beginning of the page. Load scripts at the end, some times it is not possible, it gives an error if a function being used in the page. In that case make two js files and keep necessary stuff in one js and load it at the beginning.

5. Use ‘differ’ attribute to if some scripts must be loaded at the beginning.

<script src=“knowledge-cess.js” defer></script>

6. To construct dynamic pages it is better to use .innerHTML rather than always creating DOM elements dynamically.

7. Referencing more DOM elements using document.querySelectorAll()

var matches = document.querySelectorAll("div.note, div.alert"); Reference

8. Use Javascript timers carefully. Don't let timers run unnecessarily.
9. Javascript animation and Math

Time to play with Math now, animation is nothing but playing with frames, higher the frame rate smoother the animation and more frames means more processing. The time interval we set for an animation should depend on screen refresh rate.

Understand how Javascript Animation related to Screen refresh rate 

Most screens have refresh rate of 60Hz, so 60 frames per second (60fps) is best frame rate.
Javascript timer will be set in milliseconds. so considering 1000ms and 60FPS which will give
1000ms/60fps = 16.7ms. so it is best timer value, so set 16.7ms or 17ms for your javascript timer while playing with animations.

function setInterval(function(){

10. Performance factor for PNG and JPG – PNG will be of more size compared to jpg but jpg uses more complicated decoding algorithm compared to png.

Image format PnG vs JPG and performance
The reason png size will be more is because png format will use lossless compression algorithm and jpg will use lossy compression algorithm.
11. Using requestAnimationFrame : Mozilla team proposed requestAnimationFrame method to over come from performance issues in javascript animations. Have a look into this Link
There Many more performance tuning techniques.Now let us look into some best practices of javascript


Best Practices in Javascript

 1. Use Shortcut notations

var cities = ["Bangalore","Delhi","Mysore"]


var cities = new Array();

2. Keep related stuff together

Best Practice – 

var settings = function(){
     var userDefaults = {
         categories: {"defaultCategory" : "xyz", "lastCategory":"pqr"},
         modules : {}

      function initUserDefaults(){ }

      function clearUserDefaults(){}
   } //End of settings

The above way is clean and better approach rather than separating all methods.

3. Do not use primitive types as objects

 var name = "Ram";  //Best practice
      var name = new String("Ram"); //Not recommended

4. Use === operator

   Always use === operator for comparison, It always converts (to matching types) before comparison.

   The === operator forces comparison of values and type:

 100 == "100" //true which causes problem most of the times
      100 === "100" //false Best Practice, strict type checking

5. Global Variables in Javascript

Global variables are not recommended, Avoiding global variables is best practice.

6. Using JSLint 

Identify most common problems in your javascript code using JSLint tool


Check : how Animation in javascript works and how CSS3 is better than jQuerylink 

Integrating Facebook In iOS Applications

Integrating Facebook In iOS Applications

Environment Setup :

Step1: Login into your Facebook developer account

Download Facebook iOS sdk –

Step 2: Go to My Apps and select your application ( If App is not created then do create new app)



Step 3: Go to facebook app settings page 

iOSFacebookIntegration - Settings page

iOSFacebookIntegration – Settings page

Step 4: Add new platform for iOS in settings page and fill the details

iOSFacebookIntegration - Platform

iOSFacebookIntegration – Platform


Step 5: Now copy the App ID generated and Display name




Step 6 : In your iOS project file set Facebook App ID and URL types as shown below. 

Inside iOS project set FacebookAppID and FacebookDisplayName 

Facebook Integration in iOS shows Blank Screen after login :

Setting FacebookAppId and FacebookDisplayName in iOS project plist file

This is most common problem many people face when Facebook is integrated in iOS application.

This is because the Facebook App id has not been set in plist file.

URL types and URL Schemes should be added

iOSFacebookIntegration - plist

iOSFacebookIntegration – plist


Facebook integration using Javascript library

If you are using javascript and web view then the screen black out issue can be fixed by specifying redirect URL as given below

This should work:

function loginUser()
 FB.login(function(response) { },
 {scope:'email', redirect_uri:'http://your-redirect-url'});