Thursday, February 18, 2010

ubuntu tweak

Guys checkout ubuntu tweak , a cool application in ubuntu.

You can remove many features that are default after installing like...

icons of mounted drives in the desktop.
the recent documents list..
file type associations...


there are some cool features using which u can customize your system like.

'open in terminal ' option in the dropdown list in nautilus.
'open as a root' option etc...

Wednesday, February 17, 2010

All in One mail

You say you already know this :P

mail forwarding, other than that whats there???

Heard of multiple inboxes in google mail?

I happened to check it very recently and its awesome, that is why i thought of sharing it here for everyone.

So if you are having multiple email id's and if its difficult to keep track of all the id's then go for this.

This is something in addition to the mail forwarding facility.

What you have to do is this, enable mail forwarding in all your mail id's to the mail id in which you want all the mails. Now you go to your primary email id (the one to which you forwarded all the mails) and enable the multiple inbox feature in LABS.

Take the settings and in the filter panel filter all the mails coming from each email id and label it. with say any name.

Now in the multiple inboxes panel, you can specify the search criteria for each inboxes.

You just need to add the lines ls:label_name in the column.


So now you can get all your mails in a single mail id, each appearing in a different inbox. You can specify the location of inboxes to ie to the left or bottom or top :)

Friday, November 13, 2009

Recover deleted files in ubuntu

Well..... you can recover some of the files that you deleted intentionally or accidently for ever.(that which you dont find in the trash)


There are two tools that can be used..
1. scalpel
2 foremost

install any of them..
eg

sudo apt-get install scalpel

after the package is installed..you have to edit the config file to specify the type of file that you have to recover

sudo gedit /etc/scalpel/scalpel.conf

now uncomment the types of files that you have to recover.

and then identify the address of the address of the drive from which you have to recover the file.

this can be found out from gparted
say for example sda3

now type

scalpel /dev/sda3 -o output

here you can specify a path instead of output.
by the above command it creates a folder in the directory in which you have issued the command


similarly you can use the foremost also this purpose.



sudo apt-get install foremost

now type sudo foremost -t jpeg -i /dev/sda3

Saturday, October 31, 2009

Installing lamp (apache mysql php) in linux

Everything can be done easily through the command line

sudo apt-get install apache2

this will install apache server on your system

can be checked by typing
http://localhost in your browser window

if you get a message It Works! then its success

now to install php
type

sudo apt-get install php5 libapache2-mod-php5

and now restart the apache to see if its working

type

sudo /etc/init.d/apache2 restart

now create a file say with the name testphp.php in your www folder(/var/www)

you should open it as root so
type: sudo gedit /var/www/testphp.php

and type


phpinfo();
?>


now if you type http://localhost/testphp.php in your browser you will get the file giving the information on php installed on your system

Once again open up Terminal and then copy/paste this line:
sudo apt-get install mysql-server

(optional). In order for other computers on your network to view the server you have created, you must

first edit the "Bind Address". Begin by opening up Terminal to edit the my.cnf file.

gksudo gedit /etc/mysql/my.cnf

Change the line

bind-address = 127.0.0.1


And change the 127.0.0.1 to your IP address.

To change the password of the root user

type in terminal, this will take you to the mysql console
mysql -u root

Following that copy/paste this line:

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');

(Make sure to change yourpassword to a password of your choice.)

To intall phpMyAdmin

To install a program called phpMyAdmin which is an easy tool to edit databases.Copy/paste the following line into Terminal:
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

After that is installed our next task is to get PHP to work with MySQL. To do this we will need to open a file
entitled php.ini. To open it type the following:

gksudo gedit /etc/php5/apache2/php.ini

Now we are going to have to uncomment the following line by taking out the semicolon (;).
Change this line:

;extension=mysql.so

To look like this:

extension=mysql.so


Now just restart Apache and you are all set!

sudo /etc/init.d/apache2 restart

Split and Join files in liinux

split is the command used to split large files in linux


let us split the file

music.mp3

inorder to split it to 1mb each the following command is used

split -b 1M music.mp3

here this -b refers to splitting files based on bytes, files can be splitted based on lines too it is by giving -l

this will create files named xaa xab xac ........

this can later be combined to a single file called music-combined.mp3 as

cat xa* > music-combined.mp3


more information in this regard can be obtained my refferring to the man file of split


man split

Tuesday, October 20, 2009

To read from keyboard - java

use java.io package

import java.io.*;

next you'll need an InputStreamReader to read from the System.in stream
Code:
InputStreamReader isr = new InputStreamReader(System.in) );
afterwards, you'll need a BufferedReader to store the stream

Code:
BufferedReader br = new BufferedReader(isr);

use the readLine() method to get a string

Code:
String sampleString = br.readLine();
put it all together

Code:
import java.io.*;
class RandomClass
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in) );
String sample = br.readLine()
}

Thursday, October 1, 2009

CRONTAB automate your task....

So how many of you have heard of crontab in linux.

Its something which is very useful. It automates tasks....

suppose you want to execute a task at sometime in the future (only if the system is switched on), all you need to do is add the command in the crontab.

in order to install a crontab just type crontab -e
this will open you a file to write commands with some other fields too

m h dom mon dow command

The above given is the order in which you have to make the entry in the cron..
m stands for minute of the hour
h for hour of the day(24 hour clock)
dom stands for the day of the month
mon stands for the month
dow stands for the day of the week
command this is where you specify the command which is to be executed

so as an example

34 6 9 4 * mkdir /home/username/file

the above command makes a directory named file on 9th of April at 6 hours and 34 minutes in the folder /home/username


you can also specify a range too

32-50 * 9 4 * command

the above command is executed on April 9th in every minute from 32-50 minutes in all the 24 mangagers. hours...


---the above post is incomplete, will be updated soon---