Sunday, 18 May 2014

HR Interview Questions and Answers

  1. Tell me about yourself.
  2. Why should I hire you?
  3. What are your strengths and weaknesses?
  4. Why do you want to work at our company?
  5. What is the difference between confidence and over confidence?
  6. What is the difference between hard work and smart work?
  7. How do you feel about working nights and weekends?
  8. Can you work under pressure?
  9. Are you willing to relocate or travel?
  10. What are your goals?
  11. What motivates you to do good job?
  12. What makes you angry?
  13. Give me an example of your creativity.
  14. How long would you expect to work for us if hired?
  15. Are not you overqualified for this position?
  16. Describe your ideal company, location and job.
  17. What are your career options right now?
  18. Explain how would be an asset to this organization?
  19. What are your outside interests?
  20. Would you lie for the company?
  21. Who has inspired you in your life and why?
  22. What was the toughest decision you ever had to make?
  23. Have you considered starting your own business?
  24. How do you define success and how do you measure up to your own definition?
  25. If you won $10 million lottery, would you still work?
  26. Tell me something about our company.
  27. How much salary do you expect?
  28. Where do you see yourself five years from now?
  29. On a scale of one to ten, rate me as an interviewer.
  30. Do you have any questions for me?

Friday, 16 May 2014

Zend Framework - Free Google Analytics API

Zend Framework - Free Google Analytics API

After making a successful website, we add an  google analytics code to track the activities on our website. It gives all tracking information from all geo regions on all the pages.
It help us to know daily, monthly, yearly visiter in different countries and list of pages which searched most.

But creating a report on the behalf of analytics data, is difficult stuff because it take a lot of lot of time.

Following are simplest way to get the google analytics data.
        $email = 'ADSENSE_GMAIL_USERNAME';
        $password = 'ADSENSE_GMAIL_PASSWORD';
        /** Get Connection with Analytics Account * */
        $client = Zend_Gdata_ClientLogin::getHttpClient($email, $password, Zend_Gdata_Analytics::AUTH_SERVICE_NAME);
        $service = new Zend_Gdata_Analytics($client);
        /** Get Connection with Analytics Account * */
        
        
        /** Get Analytics Account Information * */        
        $profileResults = $service->getDataFeed($service->newAccountQuery()->profiles())->current()->getExtensionElements();
        foreach($profileResults as $profileResult){
            $attributes = $profileResult->getExtensionAttributes();
            $name = $attributes['name']['value'];
            $value = $attributes['value']['value'];
            if($name=='ga:profileId'){
                $profileId = $value;
            }
            echo "$name : $value\n";
        }       
        /** Get Analytics Account Information * */
        
        
        /** Get Analytics Data */         
        $dimensions = array(
            Zend_Gdata_Analytics_DataQuery::DIMENSION_MEDIUM,
            Zend_Gdata_Analytics_DataQuery::DIMENSION_SOURCE,
            Zend_Gdata_Analytics_DataQuery::DIMENSION_BROWSER_VERSION,
            Zend_Gdata_Analytics_DataQuery::DIMENSION_MONTH,
        );

        $query = $service->newDataQuery()->setProfileId($profileId)
                ->addMetric(Zend_Gdata_Analytics_DataQuery::METRIC_BOUNCES)
                ->addMetric(Zend_Gdata_Analytics_DataQuery::METRIC_VISITS)
                ->addFilter("ga:browser==Firefox")
                ->setStartDate('2013-05-01')
                ->setEndDate('2014-05-31')
                ->addSort(Zend_Gdata_Analytics_DataQuery::METRIC_VISITS, true)
                ->addSort(Zend_Gdata_Analytics_DataQuery::METRIC_BOUNCES, false)
                ->setMaxResults(1000);
        echo "\nVisits : Bounce \n\n";
        foreach ($dimensions as $dim) {
            $query->addDimension($dim);
        }
        try{
                   $result = $service->getDataFeed($query); 
        }catch(Exception $e){
            echo $e->getMessage();die;
            
        }

        foreach ($result as $row) {
            echo $row->getMetric('ga:visits') . "\t";
            echo $row->getValue('ga:bounces') . "\n";
        }
        /** Get Analytics Data */


As an above example, you can extract all information from the Google Analytics API and stored in array or Object then can download into csv OR Excel format.