Wednesday, 24 January 2018

CodeIgniter Interview Questions & Answers

Q.1 What is CodeIgniter?
Codeigniter is an open source framework for web application. It is used to develop websites on PHP. It is loosely based on MVC pattern, and it is easy to use compare to other PHP framework.
Q.2 What helpers in CodeIgniter are and how you can load a helper file?
In CodeIgniter, helpers are group of function in a particular category that assist you to perform specific functions. In CodeIgniter, you will find many helpers like URL helpers- helping in creating links, Text helpers- perform various text formatting routines, Cookies- helpers set and read cookies.  
You can load helper file by using command $this->load->helper (‘name’) ;
Q.3 What is routing in Codeigniter?
In CodeIgniter, the way PHP files served is different rather than accessing it directly from the browser. This process is called routing. Routing in CodeIgniter gives you freedom to customize the default URL pattern to use our own URL pattern according to the requirement. So, whenever there is a request made and matches our URL pattern it will automatically direct to the specified controller and  function.
Q.4 Why is there a need to configure the URL routes?
Changing the URL routes has some benefits like
  • From SEO point of view, to make URL SEO friendly and get more user visits
  • Hide some URL element such as a function name, controller name, etc. from the users for security reasons
  • Provide different functionality to particular parts of a system
Q.5 Explain what are hooks in CodeIgniter?
Codeigniter’s hooks feature provides a way to change the inner working of the framework without hacking the core files. In other word, hooks allow you to execute a script with a particular path within the Codeigniter. Usually, it is defined in application/config/hooks.php file.
Q.6 List out different types of hook point in Codeigniter?
Different types of hook point in Codeigniter includes
  • post_controller_constructor
  • pre_controller
  • post_sytem
  • pre_system
  • cache_override
  • display_override
  • post_controller
Q.7 How you will load or add a model in CodeIgniter?
Within your controller functions, models will typically be loaded; you will use the function
  • $this->load->model (‘Model_Name’);

Q.8 What are the features of codeigniter.



  • Codeigniter is free to use,its an open source framework.
  • Its light weight.The core system requires only a few very small libraries.Not like other frameworks that require heavy file libraries.
  • CodeIgniter is Fast.Its faster than any other framework in php.
  • The URLs generated by CodeIgniter are clean and search-engine friendly.You will change any url to what ever you want from files.
  • CodeIgniter is Extensible.The system can be easily extended through the use of your own libraries, helpers, or through class extensions or system hooks.
  • CodeIgniter Uses MVC(Model View Controller) which allows great separation between logic and presentation.
  • CodeIgniter requires nearly zero configuration,does not require you to use the command line,not forced to learn a templating language.
  • Full Featured database classes with support for several platforms,Security and XSS Filtering,Error Logging.
Q.9 How you can prevent CodeIgniter from CSRF?

There are several ways to protect CodeIgniter from CSRF, one way of doing is to use a hidden field in each form on the website.  This hidden field is referred as CSRF token; it is nothing but a random value that alters with each HTTP request sent. As soon as it is inserted in the website forms, it gets saved in the user’s session as well.  So, when the form is submitted by the users, the website checks whether it is the same as the one saved in the session. If it is same then, the request is legitimate.

Q.10 How you can enable CSRF (Cross Site Request Forgery) in CodeIgniter?
You can activate CSRF (Cross Site Request Forgery) protection in CodeIgniter by operating your application/config/config.php file and setting it to
$config [ ‘csrf_protection’] = TRUE;
If you avail the form helper, the form_open() function will insert a hidden csrf field in your forms automatically.
Q.11 Mention what are the security parameter for XSS in CodeIgniter?

Codeigniter has got a cross-site scripting hack prevention filter. This filter either runs automatically or you can run it as per item basis, to filter all POST and COOKIE data that come across.  The XSS filter will target the commonly used methods to trigger JavaScript or other types of code that attempt to hijack cookies or other malicious activity. If it detects any suspicious thing or anything disallowed is encountered, it will convert the data to character entities.


Q.12 How you can link images/CSS/JavaScript from a view in codeigniter?

In HTML, there is no Codeigniter way, as such it is a PHP server side framework. Just use an absolute path to your resources to link images/CSS/JavaScript from a view in CodeIgniter

/css/styles.css
/js/query.php
/img/news/566.gpg
Q.13 What is the default URL pattern used in Codeigniter framework?
Codeigniter framework URL has four main components in default URL pattern.  First we have the server name and next we have the controller class name followed by controller function name and function parameters at the end. Codeigniter can be accessed using the URL helper. For example http://servername/controllerName/controllerFunction/parameter1/parameter2.
Q.14 How you can extend the class in Codeigniter?
To extend the native input class in CodeIgniter, you have to build a file named application/core/MY_Input.php and declare your class with
Class MY_Input extends CI_Input {
}
Q.15 What is inhibitor in CodeIgniter?
For CodeIgniter, inhibitor is an error handler class, using the native PHP functions like set_exception_handler, set_error_handler, register_shutdown_function to handle parse errors, exceptions, and fatal errors.

Friday, 5 January 2018

Repair corrupted Pen Drive or SD card using CMD

How To Repair Corrupted Pen Drive or SD Card In Simple Steps?

Repair corrupted Pen Drive or SD card using CMD.
               This process involves Windows command prompt which is commonly known as CMD. In this, you have to enter some CMD commands and Windows will forcefully format your corrupted pen drive/SD card.
               First use diskpart command Like


               Press Enter
               You will get message Like


               Write list disk


               Press Enter
               You will get message Like


               Now > Select Disk 1, as command



               Now > clean, as command


               Now > create partition primary, as command


               Now > active, as command


               Now again > select partition 1, as command



               Now to format your disk to get disk with fat32 for no data with command like,
               > format fs=fat32




DirectX Diagnostic Tool

What to write in RUN to get DirectX Diagnostic Tool to get the whole system information?

First Click on windows + R buttons to open RUN.

When RUN opens then write dxdiag in textbox and click on OK button to open DirectX Diagnostic Tool.


After that you will get a window, where you can see its whole System information ::


When you switch to another tab, you can see Display information ::


 Again when you switch to next tab, you can see Sound information ::


And again when you switch to next tab, you can see Input information ::


How to run multiple Laravel projects at same time?

Multiple Laravel Projects First run your first laravel project blog as follows: Open your command prompt and go to your drive where your...