Tuesday, November 18, 2014

how to get CKeditor value using javascript[Solve]

<script jang="javascript">

var xvalue=CKEDITOR.instances['myTextarea'].getData();

alert(xvalue);

</script>

Thursday, November 13, 2014

how to search one view used in other views in oracle?

SELECT * FROM User_Dependencies
WHERE TYPE IN
('PACKAGE',
'PACKAGE BODY', 'TYPE BODY',
'TRIGGER',
'FUNCTION',
'VIEW',
'SYNONYM',
'TYPE'
)
AND REFERENCED_OWNER = 'SERVERDB'
AND REFERENCED_NAME = 'SERVERS_V';


What main different between session and cache?

The first main difference between session and caching is: a session is per-user based but caching is not per-user based, So what does that mean? Session data is stored at the user level but caching data is stored at the application level and shared by all the users. It means that it is simply session data that will be different for the various users for all the various users, session memory will be allocated differently on the server but for the caching only one memory will be allocated on the server and if one user modifies the data of the cache for all, the user data will be modified.

Tuesday, November 11, 2014

zend framework interview questions and answers for experienced

Question: How to disable layout from controller?

?
1
$this->_helper->layout()->disableLayout();


Disable Zend Layout from controller for Ajax call only
?
1
2
3
if($this->getRequest()->isXmlHttpRequest()){
    $this->_helper->layout()->disableLayout();
}


How to change the View render file from controller?
?
1
2
3
4
function listAction(){
    //call another view file file
    $this->render("anotherViewFile");
}


How to protect your site from sql injection in zend when using select query?
?
1
2
3
4
5
$select = $this->select()               
                ->from(array('u' => 'users'), array('id', 'username'))
                ->where('name like ?',"%php%")
                ->where('user_id=?','5')
                ->where('rating<=?',10);



How to check post method in zend framework?
?
1
2
3
4
5
if($this->getRequest()->isPost()){
    //Post
}else{
//Not post
}


How to get all POST data?
?
1
$this->getRequest()->getPost();


How to get all GET data?
?
1
$this->getRequest()->getParams();


How to redirect to another page from controller?
?
1
$this->_redirect('/users/login');


How to get variable's value from get?
?
1
$id= $this->getRequest()->getParam('id');


Create Model file in zend framework?
?
1
2
3
4
class Application_Model_Users extends Zend_Db_Table_Abstract {
    protected $_name = "users";
    protected $_primary = "id";     
}


How to create object of Model?
?
1
$userObj = new Application_Model_Users();


Which Class extend the Zend Controller?
Zend_Controller_Action
For Example
?
1
2
class AjaxController extends Zend_Controller_Action {
}


Which Class extend the zend Model?
Zend_Db_Table_Abstract
For Example
?
1
class Application_Model_Users extends Zend_Db_Table_Abstract { }


What is a framework?
In software development, a framework is a defined support structure in which another software project can be organized and developed.


Why should we use framework?
Framework is a structured system where we get following things
Rapid application development(RAD).
Source codes become more manageable.
Easy to extend features.


Where we set configuration in zend framework?
We set the config in application.ini which is located in application/configs/application.ini.


What is Front Controller?
It used Front Controller pattern. zend also use singleton pattern.
=> routeStartup: This function is called before Zend_Controller_Front calls on the router to evaluate the request.
=> routeShutdown: This function is called after the router finishes routing the request.
=> dispatchLoopStartup: This is called before Zend_Controller_Front enters its dispatch loop.
=> preDispatch: called before an action is dispatched by the dispatcher.
=> postDispatch: is called after an action is dispatched by the dispatcher.


What is full form of CLA in Zend Framework?
Contributor License Agreement


Should I sign an individual CLA or a corporate CLA?
If you are contributing code as an individual- and not as part of your job at a company- you should sign the individual CLA. If you are contributing code as part of your responsibilities as an employee at a company, you should submit a corporate CLA with the names of all co-workers that you foresee contributing to the project.


How to include js from controller and view in Zend?
From within a view file: $this->headScript()->appendFile('filename.js'); From within a controller: $this->view->headScript()->appendFile('filename.js'); And then somewhere in your layout you need to echo out your headScript object: $this->headScript();


What are Naming Convention for PHP File?
1. There should not any PHP closing tag (?>)in controller & Model file.
2. Indentation should consist of 4 spaces. Tabs are not allowed.
3. The target line length is 80 characters, The maximum length of any line of PHP code is 120 characters.
4. Line termination follows the Unix text file convention. Lines must end with a single linefeed (LF) character. Linefeed characters are represented as ordinal 10, or hexadecimal 0x0A


What are Naming Convention for Classes, Interfaces, FileNames, Functions, Methods, Variables and constants?
http://framework.zend.com/manual/1.11/en/coding-standard.naming-conventions.html


What are coding style of Zend Framework?
http://framework.zend.com/manual/1.12/en/coding-standard.coding-style.html


What is Front Controller in Zend Framework?
Zend used Front Controller pattern for rendering the data. It also use singleton pattern.
=> routeStartup: This function is called before Zend_Controller_Front calls on the router to evaluate the request.
=> routeShutdown: This function is called after the router finishes routing the request.
=> dispatchLoopStartup: This is called before Zend_Controller_Front enters its dispatch loop.
=> preDispatch: called before an action is dispatched by the dispatcher.
=> postDispatch: is called after an action is dispatched by the dispatcher.

How to use update statemnet in Zend Framework?
?
1
2
3
4
5
6
7
8
9
  class Application_Model_Users extends Zend_Db_Table_Abstract {
    protected $_name = 'users';
    protected $_primary = 'id';
  
    function updateData($updateData = array()) {
        //please update dynamic data
        $this->update(array('name' => 'arun', 'type' => 'user'), array('id=?' => 10));
    }
}


How we can do multiple column ordering in Zend Framework?











  class Application_Model_Users extends Zend_Db_Table_Abstract {
    protected $_name = 'users';
    protected $_primary = 'id';
  
    function users() {
        $select = $this->select()
        ->setIntegrityCheck(false)
        ->from(array('u' => 'users'), array('name as t_name'))->order('first_name asc')->order('last_name des');
         return $this->fetchAll($select);
    }
  
}

How do you protect your site from sql injection in zend when using select query?

You have to quote the strings,

$this->getAdapter ()->quote ( );

$select->where ( " = ", );

OR (If you are using the question mark after equal to sign)

$select->where ( " = ? ", );

How to include css from controller and view in zend?


include within a view file: $this->headLink()->appendStylesheet(‘filename.css’);

include  within a controller: $this->view->headLink()->appendStylesheet(‘filename.css’);

And then somewhere in your layout you need to echo out your headLink object:

headLink();?>