Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Monday, February 28, 2011

10 Things to do immediately after installing Ubuntu or XUbuntu 2011

1. Install Google Chrome

To install Google Chrome you can go to http://www.google.com/chrome and click Download Google Chrome Button and follow the downloading procedure.

or

Applications -> Ubuntu Software Center and Search for "Google Chrome" and you will get Google Chromium Web Browser as search result. Click "Install" to automatically get installed.

2. Install VLC

VLC player is the most downloaded and most distributions supported Video and Audio Player. And VLC supports many video and audio formats.

To download and install, open the terminal and write:

sudo apt-get install vlc

If terminal ask for a password type the root password. 
Note: When you write you will not see the password. 

3. Adobe Flash Player

To view most web pages online you must install Adobe Flash Player. Google Chrome has it's own Adobe Flash Player and you don't need to install Adobe Flash Player if you only use Google Chrome. But for Mozilla Firefox and other browsers you must install Adobe Flash Player.


To install, type in termianl:


sudo apt-get install flashplugin-nonfree

4. Install MPlayer.


Yet, another advanced but very simple video and audio player.


sudo apt-get install mplayer

and

sudo apt-get install w32codecs libdvdcss2

5.  Installing Unrar


sudo apt-get -y install unrar 

Sunday, February 6, 2011

Install tor in Ubuntu

Do not use the packages in Ubuntu's universe. They are unmaintained and out of date. That means you'll be missing stability and security fixes.

You'll need to set up our package repository before you can fetch Tor. First, you need to figure out the name of your distribution. A quick command to run is lsb_release -c. Here's a quick mapping:

Ubuntu 10.10 is "maverick"
Ubuntu 10.04 or Trisquel 4.0 is "lucid"
Ubuntu 9.10 or Trisquel 3.5 is "karmic"
Ubuntu 9.04 is "jaunty"
Ubuntu 8.10 is "intrepid"
Ubuntu 8.04 is "hardy"
Debian Etch is "etch"
Debian Lenny is "lenny"

Then add this line to your /etc/apt/sources.list file:
deb http://deb.torproject.org/torproject.org <DISTRIBUTION> main
where you put the codename of your distribution (i.e. etch, lenny, sid, maverick, lucid, karmic, jaunty, intrepid, hardy or whatever it is) in place of <DISTRIBUTION>.
Then add the gpg key used to sign the packages by running the following commands at your command prompt:

gpg --keyserver keys.gnupg.net --recv 886DDD89
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -

Now refresh your sources and install Tor by running the following commands (as root) at your command prompt:

apt-get update
apt-get install tor tor-geoipdb

To start:
make sure the tor and privoxy services have been started

sudo /etc/init.d/tor start
sudo /etc/init.d/privoxy start

Then start vidalia.....

Friday, February 4, 2011

Install VirtualEnv in Ubuntu

Once virtualenv is installed, you have the power to create any number of small, self-contained “virtual Python environments” where packages can be installed,
un-installed, and experimented with without contaminating your system-wide Python. When a particular project or experiment is over, you simply remove its virtual environment directory, and your system is clean. In this case, we want to create a virtual environment in which to test the googlemaps package. If you
have never installed virtualenv on your system before, visit this URL to download and install it:

http://pypi.python.org/pypi/virtualenv

Once you have virtualenv installed, you can create a new environment like this (on Windows, the directory containing the Python binary in the virtual environment will be named “Scripts” instead):

$ virtualenv --no-site-packages gmapenv
$ cd gmapenv
$ ls
bin/ include/ lib/
$ . bin/activate
$ python -c 'import googlemaps'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named googlemaps

As you can see, the googlemaps package is not yet available! To install it, use the pip command that is inside your virtualenv and that is now on your path thanks to the activate command that you ran:

$ pip install googlemaps
Downloading/unpacking googlemaps
Downloading googlemaps-1.0.2.tar.gz (60Kb): 60Kb downloaded
Running setup.py egg_info for package googlemaps
Installing collected packages: googlemaps
Running setup.py install for googlemaps
Successfully installed googlemaps
Cleaning up...

The python binary inside the virtualenv will now have the googlemaps package available:

$ python -c 'import googlemaps'

Now that you have the googlemaps package installed, you should be able to run the simple program named search1.py.

#!/usr/bin/env python
# Fetching a Longitude and Latitudefrom googlemaps import GoogleMaps
address = '207 N. Defiance St, Archbold, OH'
print GoogleMaps().address_to_latlng(address)
Running it at the command line, you should see a result like this:
$ python search1.py

(41.5228242, -84.3063479)



Credits goes to Foundations of Python Network Programming(Apress)

Thursday, November 11, 2010

Getting started JDBC in Ubuntu with MySQL

Installation of MySQL

Install mysql client, server and the jdbc connector, either via synaptic or by using the following.

sudo apt-get install mysql-server
sudo apt-get install mysql-client
sudo apt-get install libmysql-java

Set up MySQL default password 

Set up the password for the root user as 'root' or whatever you want. The last entry is the password.

mysqladmin -u <root> password <root>

Use MySQL client with Terminal


Go to Applications --> Accessories --> Terminal

Now type: sudo mysql --user=<user> --password=<password>

Create a database 


create database <leann>; //Here "leann" is the database name. Don't forget semi-colon.

User Creation and privileges


Create a user with access to that table. Replace the items in square brackets by the database name, and the chosen user and password. Don't type in the square brackets !

grant all privileges on <database>. * to <user>@localhost identified by <password>;
flush privileges;

Setting up the user to use JDBC in ubuntu

CLASSPATH=$CLASSPATH:/usr/share/java/mysql.jar
export CLASSPATH

Alternatively, you can set it for all users, by editing /etc/environment.

CLASSPATH=".:/usr/share/java/mysql.jar"

Testing in Java

import java.sql.*;
import java.util.Properties;
/**
 * https://help.ubuntu.com
 **/
public class DBDemo
{
  // The JDBC Connector Class.
  private static final String dbClassName = "com.mysql.jdbc.Driver";

  // Connection string. emotherearth is the database the program
  // is connecting to. You can include user and password after this
  // by adding (say) ?user=paulr&password=paulr. Not recommended!

  private static final String CONNECTION =
                          "jdbc:mysql://127.0.0.1/emotherearth";

  public static void main(String[] args) throws
                             ClassNotFoundException,SQLException
  {
    System.out.println(dbClassName);
    // Class.forName(xxx) loads the jdbc classes and
    // creates a drivermanager class factory
    Class.forName(dbClassName);

    // Properties for user and password. Here the user and password are both 'paulr'
    Properties p = new Properties();
    p.put("user","paulr");
    p.put("password","paulr");

    // Now try to connect
    Connection c = DriverManager.getConnection(CONNECTION,p);

    System.out.println("It works !");
    c.close();
    }
}