Category: Ubuntu

Usually all the linux distributions do start the graphical environment automatically. Its good, but it becomes little pain of linux nerds, they want to use it in there own ways. So this is a simple trick which will enable you to boot in console mode with help of Grub.

You just need to edit the following file.

/etc/default/grub

And the find the following line

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

and replace it with following.

GRUB_CMDLINE_LINUX_DEFAULT="text"

Save the file and then execute following command in the command window ( Terminal / Console ).

sudo update-grub

Thats is, next time you are going to boot in console mode. But, next thing is how run the graphical console.

Just do this, and it will run you default graphical manager.

startx

If you wish to do some other Graphical desktop then you have to create and .xinitrc file inside your home directory.

Disks, This program comes default with ubuntu 12.10, it has many improved features this time. One important feature is, it also controls HDD Drive speed, which can end up in maximizing performance to battery.

After opening the Drive Settings, It shows power managements options for HDD. You can set power as low as possible to increase the Drive speed.

Next is, Jupiter applet, , after installing, start the jupiter applet and change power settings to Power Saving Mode.

Next and the last is, PowerTOP, install it by typing the terminal.

$ sudo apt-get install powertop

After installing it, give command in the terminal.

$ sudo powertop

Your application will start running, switch screens with left and right arrow, and get into “Tuneable Tab” and change all setting which are bad.

Thats what made my battery backup approximately 80 minutes more then my normal battery backup, Thanks for reading, I hope you find this post helpful.

Hey Everybody, I’m back with very interesting tutorial, that is a simple Database Driven Application in Zend Framework. Before I begin, I must tell you I am assuming that you are having Ubuntu installed on your system, and you are known to languages HTML and PHP.
The requirements as under ..
1) Latest version of PHP, MySql Database and Apache Web Server(httpd) are installed on your system.
2) mod_rewrite extension of Apache must be enabled. To enable, do the following (only for Debian based distros, like Ubuntu) :sudo a2enmod rewrite
and don’t forget to restart Apache.sudo service apache2 restart
3) A BIG Cup of Coffee.

Lets Start, First of all, make a directory structure like this, project/ must be placed inside the /var/www/ Directory :

We have placed the required Zend Framework Files, more interesting thing is the next.
create index.php file inside the project/ directory and write the following code also readout the comments given in the code.
———————————————–
<?php
define(‘ROOT_DIR’, dirname(__FILE__));

$frontController->setControllerDirectory(ROOT_DIR.’/application/controllers’);
$frontController->dispatch();
?>
———————————————–
So this was the index.php file, When we will open this file, Zend will lookout for IndexController.php inside the controllers/ directory which we have defined in the index.php file, therefore create the IndexController.php inside project/application/controllers/ and write the following code in it.

NOTE: Be careful about the case of files and codes, all are case-sensitive.
———————————————–
// setting up the controller here..
<?php

?>
———————————————–
and now the inside the IndexController.php we created the class with the same name, and indexAction() is created. indexAction() will look for index.phtml inside the project/application/views/scripts/index/ so just create it, whatever you will write in this file, directly comes to your view. Similarly create error.phtml in project/application/views/scripts/error/ and write anything that will identify you, whenever you faced the error.
Next, create .htacess file in project/ folder and write following code in it
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

This is the file where mod_rewrite extension of Apache Web Server(httpd) is used to rewrite the URLs, as I will not discuss this now.
Now, I must tell you that we are creating database application to store the basic information of the user into the database and view it. So firstly I’m going to setup the view page. To do so we must create a database and a table inside it
Create a Database and note down the name you created. Create table by executing the following query :
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(75) NOT NULL,
`pname` varchar(75) NOT NULL,
`address` varchar(100) NOT NULL,
`contact` varchar(15) NOT NULL,
`hobbies` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;

We have created the Database configuration file, now add the following lines to index.php
———————————————–
$config = new Zend_Config_Ini(ROOT_DIR.’/application/config.ini’, ‘general’);
$db = Zend_Db::factory($config->db);
Zend_Db_Table::setDefaultAdapter($db);
———————————————–
now it should look like ..
———————————————–
<?php
define(‘ROOT_DIR’, dirname(__FILE__));

$frontController->setControllerDirectory(ROOT_DIR.’/application/controllers’);
$frontController->dispatch();
?>
———————————————–
I’ve also added a form to view the data in specific defined order as desired by the viewer, So create a file named SortForm.php inside /project/application/forms directory and write following code.
———————————————–
<?php
class SortForm extends Zend_Form
{
public function init()
{

}
}
?>
———————————————–
so We also update the IndexController.php and so as the index.phtml, the respective updated codes are embedded below.
IndexController.php
———————————————–
<?php
class IndexController extends Zend_Controller_Action
{
public function indexAction()
{

</table>
———————————————–
We have to setup a model for the Database table which we are using, which is also used in indexAction() of IndexController.php file so, create a file Users.php which resides in /project/application/models/ directory and write the corresponding code.
———————————————–

echo $exception->getMessage();
echo “<br /><pre>”;
echo $exception->getTraceAsString();
}
}
?>
———————————————–NOTE: If you are a beginner with PHP application or you’re facing problems in understanding, you must take a break here, try reading next after sometime.
Next is the Data Entry form for user, create a form named CustomForm.php inside project/application/forms/ directory and write the following code to create a form for Data Entry.
———————————————–
<?php
class CustomForm extends Zend_Form
{
public function init()
{
$this->setMethod(‘post’);

echo $this->form;
?>
———————————————–
Now we are done with all the coding. You must try running your application now at
Viewing the Entries :http://localhost/project/index
Adding Entries :http://localhost/project/index/add
While looking at the links you me seem that how http://localhost/project/index/add will run, you have created to add/ Directory inside the index/ Directory, then I must tell you that, It is the Magic of Rewrite_mod.
Try running your application, if your face any error, just make sure following things are right again ->
1) Rewrite_mod is enabled
2) your directories and files are readable to you.
3) Re-check the braces, most of the times Errors are with the braces.
4) check your configuration paths in index.php.
5) Also, Try refilling your cup of coffee.

Being Lazy ? huh ? Download the Source
I hope I have not missed something.
Good Luck.