Learner Adda
Lerner Adda for Technology, Coding, Programming. How to do and what not! This is your Adda..
Thursday, 4 June 2015
Friday, 21 November 2014
What is PHP??
PHP is a popular scripting language now-a-days in web development. Its a recursive acronym for PHP: Hypertext Preprocessor. Its is completely open source and used for general purpose scripting.
Its basically called as a server side scripting language. It is originally derived from PHP: Personal Home Page.
PHP is an alternative to Microsft's ASP(Active Server Pages). Like in ASP, the PHP script is embedded in a webpage along with HTML. Before the page is sent to a user that has requested it, the webserver calls php to interpret and perform the operations called for in the php script.
The Html file that includes php script is typically given a file name with extension as .php or .php3 or .phtml. Like ASP, it is also thought of as "dynamic HTML pages", since content will vary based on the results of interpreting the script.
Here are few advantages of using php
Its basically called as a server side scripting language. It is originally derived from PHP: Personal Home Page.
The Html file that includes php script is typically given a file name with extension as .php or .php3 or .phtml. Like ASP, it is also thought of as "dynamic HTML pages", since content will vary based on the results of interpreting the script.
Here are few advantages of using php
- It is mainly helpful to generate a webpage dynamically.
- It supports a wide range of databases
- Its is used to send mails
- It is very helpful in file handling
- It also encrypts data
- It can be used to control user-access
- It can be able to create sessions
- It can send and receive cookies
- It can collect form data
- It is also used to output images, PDF Files, XML etc.
Thursday, 12 December 2013
phpMyAdmin
WHAT is PHPmyadmin?
Most scripts you use to power your blog, shopping cart or community forum use a combination of PHP and MySQL. PHP is the Web programming language that forms the script, and MySQL is the format of the database that stores information your script needs to run. For instance, the popular blogging script WordPress store posts, comments, links, user data, options and more in your MySQL database. When you need to access that information–to change a password, for example–you use phpMyAdmin.
In short, it is one of the best Web-based, visual tool that lets you browse and edit your MySQL databases. Without it, you could edit your databases and view them in their entirety, in one long text file. If you were familiar with MySQL, you could manually edit anything in your database. However, this process would take longer than with the use of the Web tool. Furthermore, it’s much easier to undo unwanted changes, some of which might break your website, with phpMyAdmin.
In short, it is one of the best Web-based, visual tool that lets you browse and edit your MySQL databases. Without it, you could edit your databases and view them in their entirety, in one long text file. If you were familiar with MySQL, you could manually edit anything in your database. However, this process would take longer than with the use of the Web tool. Furthermore, it’s much easier to undo unwanted changes, some of which might break your website, with phpMyAdmin.
ACCESSING PHPMYADMIN
You can log on to this utility from your host’s control panel. Hosts that use control pane software like cPanel or H-Sphere often include an icon to phpMyAdmin directly from the front page, so you needn’t click around to find it. You may have a list of users, and you can choose the one that you want to log in as if you have more than one. However, your host many not allow multiple users or databases, which will prompt phpMyAdmin to open immediately.
what PHPMYADMIN can do?
Once you have the tool open, you’ll see a lot of information. It can be overwhelming at first, but databases use a structure that makes them easy to navigate once you become familiar with them. The general layout shows the name of your database(s) on the left. Clicking the name will expand to show all your tables. If you use complex or multiple scripts, this list might be quite long. For example, a single database might have multiple blog installations what use different prefixes. If you use the prefixes “blog1_” and “blog2_”, it’s easier to see which tablets belong to which script.
You can simply browse to get a feel for your database. Some information in your tables might not be human-friendly, but other information will make sense to you. The various tabs provide different options. Perform operations with lines of code from the “SQL” tab. phpMyAdmin lets you manually import or export entire databases or tables in a variety of formats as well. You can locate data within your database using the “Search” tab or create, delete and otherwise modify tables from the “Operations” tab.
phpMyAdmin is crucial if you want to understand or modify your MySQL databases; although, it might appear differently to users based on the version or themes that your host uses.
You can simply browse to get a feel for your database. Some information in your tables might not be human-friendly, but other information will make sense to you. The various tabs provide different options. Perform operations with lines of code from the “SQL” tab. phpMyAdmin lets you manually import or export entire databases or tables in a variety of formats as well. You can locate data within your database using the “Search” tab or create, delete and otherwise modify tables from the “Operations” tab.
phpMyAdmin is crucial if you want to understand or modify your MySQL databases; although, it might appear differently to users based on the version or themes that your host uses.
Saturday, 16 November 2013
Best PHP Framework for beginners
This is a topic that is not very well understood by people who jump into development pool.
PHP frameworks help to promote rapid application development, which saves you time, helps build more stable applications, and reduces the amount of repetitive coding for developers. Frameworks can also help beginners to build more stable apps by ensuring proper database interaction and coding on the presentation layer. This allows you to spend more time creating the actual web application, instead of spending time writing repetitive code and writing the tools for your project.
PHP frameworks help to promote rapid application development, which saves you time, helps build more stable applications, and reduces the amount of repetitive coding for developers. Frameworks can also help beginners to build more stable apps by ensuring proper database interaction and coding on the presentation layer. This allows you to spend more time creating the actual web application, instead of spending time writing repetitive code and writing the tools for your project.
Why should one use a PHP framework ?
Developers should utilize PHP frameworks for various reasons, but the number one reason is for speeding up the development process. Reusing code across similar projects will save the developer a substantial amount of time and effort.
Why should we not use a PHP framework ?
- You will learn a lot of stuff by writing your own pieces of code. I have been working like that and I have learned a lot of different things about PHP that I did not know before.
- There are a lot of things in frameworks that you do not need and by making your own you can get only whatever you want and use in your project.
- Think about all of the settings that the other frameworks have to go through when loading and the database queries that involves. You save yourself all of that loading by writing code from scratch.
- If you are going to make a small project, such as a simple portfolio website, then a framework would just be more work than necessary. You can choose then to write raw php code.
5 of the best php frameworks for web developers.
1) Symfony
Symfony is a full-stack framework, a library of cohesive classes written in PHP 5. It provides an architecture, components and tools for developers to build complex web applications faster. Choosing Symfony allows you to release your applications earlier, host and scale them without problem, and maintain them over time with no surprise.
Read more about this framework here.
2) Zend Framework
Zend Framework 2 is an open source framework for developing web applications and services using PHP 5.3+. Zend Framework 2 uses 100% object-oriented code and uses most of the new features of PHP 5.3, namely namespaces, late static binding, lambda functions and closures. Zend Framework 2 evolved from Zend Framework 1, a successful PHP framework with over 15 million downloads.
Read more about this framework here.
3) Yii Framework
Yii is a high-performance PHP framework best for developing Web 2.0 applications.
Yii comes with rich features: MVC, DAO/ActiveRecord, I18N/L10N, caching, authentication and role-based access control, scaffolding, testing, etc. It can reduce your development time significantly.
Read more about this framework here.
4) CakePHP
CakePHP is a rapid development framework for PHP that provides an extensible architecture for developing, maintaining, and deploying applications.
Read more about this framework here.
5) CodeIgniter
CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications.
Read more about this framework here.
Conclusion
Bottom line, you should check the situation and make a good analysis before starting to use a php framework in your project. It is better to understand what advantages gives you a framework, check your project, see if you will save time not writing that stuff, and then decide if you use it or not.
Saturday, 14 September 2013
Windows Batch File - Create, Edit & Execute
The Windows Batch File is simple text file that contains a sequence, or batch of commands. It is mainly useful for storing sets of commands to run one after the other to accomplish a repeated task.
Instead of entering a command and executing it manually every time,
you can easily give the batch file name to execute those commands automatically on command prompt. You can also put few conditions and execute the commands needed.
In DOS (DOS - Disk Operating System) systems the batch files end with .bat or .BAT extension.
The Best known DOS file is AUTOEXE.BAT which initializes DOS when you start the system.
Create a new text document. Double click the file once the file opens select File>save as, and in the save as window, provide you sample name for the batch file and then add the extension .BAT or .bat on the end.
Which ends up creating sample.bat file.
Note: Also you need to check that windows doesn't stick to the standard .txt format as extension on the end of this sample file.
To check this change the file type from .txt to "all files" as shown in the picture below.
Go to Start menu and open All Programs > Accessories > Command Prompt or go to run and enter cmd and press enter to open command prompt.
Instead of entering a command and executing it manually every time,
you can easily give the batch file name to execute those commands automatically on command prompt. You can also put few conditions and execute the commands needed.
In DOS (DOS - Disk Operating System) systems the batch files end with .bat or .BAT extension.
The Best known DOS file is AUTOEXE.BAT which initializes DOS when you start the system.
Step 1 : Create a .BAT file
Create a new text document. Double click the file once the file opens select File>save as, and in the save as window, provide you sample name for the batch file and then add the extension .BAT or .bat on the end.
Which ends up creating sample.bat file.
Note: Also you need to check that windows doesn't stick to the standard .txt format as extension on the end of this sample file.
To check this change the file type from .txt to "all files" as shown in the picture below.
Step 2 : Edit the batch file - Also learn few simple commands here
If you know how to run commands in command prompt then it is very easy.
Here in the batch file what we do is put all the commands in the file and execute them automatically one after the other, rather than typing it one by one manually and wait for the result.
Let's learn few basic batch commands which will be helpful. Here the advantage it is not case Sensitive.
Title : The window name for the batch file.
Echo : The print statement for the batch files. Anything followed by the word ECHO will be displayed in the command prompt as text.
Echo OFF : This is typically used by all the batch programmers at the beginning of their files. It actually means that the program won’t show the command that you told it to run while it’s running – it will ll just display the command. I would recommend that after you run this sample program, you try removing this line from your code to see what's the magic of this.
PAUSE: This outputs the "press any key to continue" message. This is mainly used to make human intervention to continue running the batch file after "Enter" is pressed.
CLS : Clears the DOS Window screen.
PING: Pings an IP, with this we can be able to check whether we are able to connect to it or not. It returns the time taken to ping and by default it tries to ping itself for 3 times.
Here is the sample.bat file code.
Step 3 : Execute the batch file
Go to Start menu and open All Programs > Accessories > Command Prompt or go to run and enter cmd and press enter to open command prompt.
By default Local disk where the operating system installed will by default.
If you type echo "Learner Adda", then it will be printed.
If you type echo "Learner Adda", then it will be printed.
Go to the directory where the batch file is placed and execute the script in the following way.
C:\> cd learneradda
C:\learneradda\> sample.bat
Then the sample.bat batch file will be executed and result will be printed. Here is the example batch script for your reference.
Useful Batch Script
Before we start creation of the batch script to move even and odd named files to separate folders, we need to know how to create a batch file
How to create a windows Batch file?
Create a sample text file and change its extension to BAT or bat. Then windows recognizes it as a Batch file and executes the series of commands placed in the batch file.
Here is the code.
Code Explanation:
How to create a windows Batch file?
Create a sample text file and change its extension to BAT or bat. Then windows recognizes it as a Batch file and executes the series of commands placed in the batch file.
Here is the code.
Code Explanation:
Subscribe to:
Posts (Atom)