Friday, May 13, 2011

Installing tomcat6 Ubuntu 10.10

Hello all,

The following are the direct steps for installing tomcat 6 under Ubuntu and get started using it:
open a terminal and write the following commands while you are a root ( su ).

NOTE: Do not forget to restart the service after each change to get the effects applied.


apt-get install tomcat6 tomcat6-admin tomcat6-common tomcat6-user tomcat6-docs tomcat6-examples

The previous command installs the necessary files and libraries to run tomcat.

To insure the server has been installed, write the following in your browser:
localhost:8080 (this port can be seen and changed. look at section changing port number to know the step. )

You will get a message indicates every thing is ok. I recommend you to read it carefully, It gives you the next steps to start.

As you will read you will mostly need to do the following steps:

Add user with a manager role to be able to use the web administration tool. To do this you will need to edit /etc/tomcat6/tomcat-user.xml file

Add the following under the tag names tomcat-users

Common Used Commands:

Also There is some commands you will need frequently to start, stop, restart the service:

sudo /etc/init.d/tomcat6 start

sudo /etc/init.d/tomcat6 stop

sudo /etc/init.d/tomcat6 restart

sudo /etc/init.d/tomcat6 status

Changing Port Number

if you are running multiple web services, you may be in need to change the tomcat port (default 8080) to another UN-USED port number.

This can be done by editing the /etc/tomcat6/server.xml

Search for the following :
8080" protocol="HTTP/1.1"
redirectPort="8443" />

change the 8080 to any number you want.

Running your web applications:

your applications should be placed in /var/lib/tomcat6/webapps/
to be recognized and run though web browser. After that, you can access it directly from your web browser

I guess this all what you need to get started.

Good luck.

Mohammed Saudi

Thursday, May 12, 2011

Copy Virtual Machine ( Hard Disk VDI) in virtual box

simply issue the following command from the terminal( Linux) or cmd (windows):

VBoxManage clonevdi pathOfMyFirstHD.vdi pathOfMyCloneHd.vdi

Wednesday, May 4, 2011

Add "open in terminal" to ubuntu menu


Issue this command and you will find "Open in terminal" option appears in the shotcut menu while you are inside folders and write click in empty space.

This will open that path directly in terminal.

sudo apt-get install nautilus-open-terminal

Restart nautlius

killall nautlius

best wishes,


Install Arial Font Ubuntu

Dear all, here is the direct way to install Arial and other microsoft fonts in ubuntu.

just issue the following 2 commands as a root and accept any upcoming messages (click tab to move between options )

sudo apt-get install ttf-mscorefonts-installer
dpkg-reconfigure ttf-mscorefonts-installer

Accept some license issues and so, just by clicking Ok to the popup dialogues

you will got this message when you done
All done, no errors.
All fonts downloaded and installed.
Updating fontconfig cache for /usr/share/fonts/truetype/msttcorefonts

Good Luck,

Tuesday, May 3, 2011

RedHat Package Manager rpm guide

Hello ALL,
This is a fast tutorial on linux RedHat package manager . Let's navigate the rpm (Redhat package manager) command with its options.

rpm : no :D, It does not work without options.

Listing Packages
rpm : no :D, It does not work without options.

- Query all packages :
rpm -qa // you may add | more command to see them page by page and navigate between pages using space & enter keys

- Query Specific package
rpm -q pkgName

- Query with more details(informations) about the package
rpm -qi pkgName

-Query all files used by this package
rpm -ql pkgName

This may be enough but we can add 2 more useful options
-qf over specific file will check which packages this file belongs to or generated by.
rpm -qf file-path-name

-qlp do the same but over rpm archive , not a file

rpm -qlp package-path-name.rpm

rpm -i packageName.rpm installs the package
rpm -ivh packageName.rpm installs the package, showing you what is going on during the installation [ verbose messages with hash sign indicates the progress

Upgrading installed pacckage
rpm -U packageName.rpm upgrades the package
rpm -Uvh packageName.rpm upgrade showing you what is going on

rpm -e pkgName erase the package
rpm -e --nodeps pkgName erase and neglect the dependences messages

Verification for some package verify deifferent aspects of information related to files, owner, group, ....
detailed explanation can be found here

rpm -V pkgName
rpm -Va for all packages

Good luck,

Monday, May 2, 2011

Change gnome Window Buttons Position and Arrangement UBUNTU

many of people (including me) does not like the max, min and close buttons on the left of the window title bar. Here is how to change position and arrangement if u want so.

Terminal> gconf-editor
go to: /apps/metacity/general
Change the 'button_layout' key to "menu:minimize,maximize,close"

And here (in the value ) you can change the arrangement like "menu:close,minimize,maximize"


Get information about your Ubuntu version


Here is a list of commands to help you finding information about Ubuntu Version and related kernel information:

cat /etc/issue
cat /etc/lsb-release
uname -a [rvu]

Sunday, April 17, 2011

Understanding Streams in Java

Understanding Streams in Java


By: Mohammed Saudi.

Download examples :

A Data Stream is a flow of data between data source and data sink (the data goes to it).
Data source or sink could be for example disk file, device or network socket.

Two types of streams available in java ; Byte streams and Character streams. They differ in the level they are dealing with data; either data is read/written in 8-bit fashion ( byte stream) or in 16-bit unicode character fashion (character based).

If you are not working with images or sounds, it would be easier and better to use character-based streams; they handle the conversion and encoding stuff.

There is also a helpful classes ( and that handle the gap between those two types. They convert byte data into character-based.

Also there is a Data stream classes that reads data directly by type (int, string, float ,... ). They relay on a stream objects.

DataInputStream and DataOutputStream. are typical examples.
DataOutputStream(OutputStream out)
DataInputStream(InputStream in)

Examples of Byte Stream classes are
InputStreamReader, OutputStreamWriter, BufferedReader and BufferedWriter.

Examples of character Stream classes ( data sink streams) are
FileReader and FileWriter

===== Reading Files using byte-based streams ====

This Program reads "myInputFile.txt" file byte by byte and write the data into the file "myOutputFile.txt"
you should have myInputFile.txt in the same path of this java file

By: Mohammed Saudi.


public class ReadBytes {
public static void main(String[] args) throws IOException {
FileInputStream inStream = null;
FileOutputStream outStream = null;
try {
inStream = new FileInputStream("myInputFile.txt");
outStream = new FileOutputStream("myOutputFile.txt");
int c; //I use int here because I use the read function blow which returns an integer.

while ((c = != -1) {


catch (Exception fe){


finally {
if (inStream != null) {
if (outStream != null) {

===== Reading Files using character-based streams ====

This Program is the same as "ReadBytes" except it uses filereader and filewritter classes
you should have myInputFile.txt in the same path of this java file

* note: you may have a problem in character encoding when using filewritter class.
If so, use the OutputStreamWriter on a FileOutputStream instead.

By: Mohammed Saudi.



// Displays contents of a file
//(e.g. java Type app.ini)
public class ReadChars
public static void main(
String args[]) throws Exception
// Open input/output and setup variables
FileReader fr = new FileReader("myInputFile.txt");
FileWriter fw = new FileWriter("myOutputFile.txt");

char cToReadIn[] = new char[1000];
int read = 0;

// Read (and print) till end of file
while ((read = != -1)

// Close shop

Download examples :

Wednesday, April 13, 2011

fix firefox youtube fullscreen error in ubuntu

Hello All,
There is a problem in firefox when playing youtube videos in full screen mode. Here is the solution :

sudo mkdir /etc/adobe
sudo echo "OverrideGPUValidation = 1" >> /etc/adobe/mms.cfg

That's it.

Friday, April 8, 2011

Install gcc windows

To install gcc compiler in windows operating system do the following :

1- go to to download the mingw installer or simply go directly to

2- click download mingw-get-inst-****
this will download a small exe to help you download and install the required files.
3- click the exe file downloaded and click next

4- keep clicking Next as there is no changes required.

NOTE: You can install the C++ compiler -If you want - by just clicking the check box besides C++ compiler

The installer will do the rest of the job for you. It will download and install the required files.
Then click finish.


You will need to add environment variable to the system to be able to use the gcc command at the command prompt.
Follow the next steps to do this :

1- right click on my computer - > Properties -> Advanced - > Environment variables

2- click the PATH variable as indicated then click EDIT
3- Add " ; C:\MinGW\bin to the end of the line "
semicolon followed by the path

4 - Now you are able to compile your c applications using GCC compiler.

** To do this, Click Start -> RUN (or keyboard windows tbutton +R) and write CMD

Compile your code by writing the following command:

gcc c_file_name_path -o c_output_filename

That's it.

Thursday, April 7, 2011

Installing VMware player ubuntu

Hello All,
VMWare offers a free software called VMWare player which you can use to work with virtual machines. of course It has less features than the Work Station version like the ability to make a team and record your WM session but you still can have your work done with the FREE version.

To install it in ubuntu do the following:

first download the software from HERE,
note: you will need to register to be able to download.
then :
Open terminal
Change to the directory you downloaded your file to
issue the following command ,,,
gksudo bash ./VMware-Player-xxxxxxxx
where xxxx is the version details.
This will run a GUI installer, follow the instruction and after you finish, 
you will find it installed in Applications, System Tools , VMware player

Enjoy !.

Monday, April 4, 2011

Configuring Proxy Settings Manually Ubuntu


sudo gedit /etc/apt/apt.conf &

then inside apt.conf file write your proxy settings in the following format:
for http:
Acquire::http::Proxy "http://proxy_server_here:port_here";

for ftp: example
Acquire::ftp::Proxy "";

If you want to change this, just remove the lines we just wrote.

have fun

Wednesday, March 30, 2011

Get your 4 Giga Ram ( or more) to work under ubuntu 10.10

Hello All,
Usually ubuntu 10.10 (the 32-bit version) does not support 4 giga ram addressing, But the 64-bit version do.

To get your 32-bit version to work you need to install the following:

so go ahead and update the system then apt-get install "the above list"

$ sudo apt-get update
$ sudo sudo apt-get install linux-headers-server linux-image-server linux-server
$ sudo apt-get install linux-generic-pae linux-headers-generic-pae

reboot your system ... and have fun !.

Wednesday, March 23, 2011

install .rpm packages in Ubuntu

Hello, Here are the steps :

install alien package

sudo apt-get install alien

then simply run

alien package.rpm

Sunday, March 6, 2011

Install and start Oracle 10g Express in Ubuntu 10.10

Here are The steps to download, install and start Oracle Express 10g getting the History and Arrow Keys to work in Terminal.

Add this line to /etc/apt/sources.list file:

deb unstable main non-free

Next, you will need to add the GPG key.

wget -O- | sudo apt-key add -

As root, type:

apt-get update

To install the XE database server, apt-get 'oracle-xe-universal' or 'oracle-xe' (Western European support only).

apt-get install oracle-xe-universal

If you only need the XE client, type

apt-get install oracle-xe-client


As root, type:
/etc/init.d/oracle-xe configure

Edit your .bashrc file to include the lines:

ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server PATH=$PATH:$ORACLE_HOME/bin export ORACLE_HOME export ORACLE_SID=XE
export PATH

Start a new bash shell for the changes to take effect.

To log in as a database administrator:
conn sys as sysdba ; Then write your password

To Access database home from HTTP

To add new user to the system and give him dba privilages, write the following in the SQL Plus CMD

create user write_user_name identified by write_user_password;
grant dba to user_name;

To unlock the HR account to work with examples provided by Oracle.

alter user HR account unlock ; alter user HR identified by $password ; exit


To get the history and arrows keys to work:
Download qgplus , Click Here

after you download gqlplus,

1. find your path variable:
echo $PATH
you should see this path in there:

2. Extract the gqplus file you have downloaded and take out the gqlplus executable from the linux folder inside it.

3. place the executable in any of the path directories.

e.g. Copy it here :/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin

Then from the terminal run it.


Have Fun :) .





Monday, January 17, 2011

disabling beep in solaris

This annoying beep can be removes simply by going to : Edit -> profile preferences -> uncheck the terminal beep box.

Friday, January 14, 2011

Installing Acrobat Reader under Linux

To Install Adobe Acrobat Reader do the following:

-> Download it HERE (make sure above download word that Your system: Linux).
-> Run it as .bin file (steps here).

That's it.

Run .bin files in Linux

To run .bin files you only need to write "./" followed by the file name while you are in the directory containing that file. Those files needs to marked as executable , so you will need to change its permissions.

Switch To root first ("su" command, then write the password) then apply the following:

filePath:# chmod a+x name_of_file.bin
Then run it by writing:

filePath:# ./name_of_file.bin

Tuesday, January 11, 2011

Configuring Microsoft True Type Fonts in Fedora 14

How To Configure Fedora 14 fonts:
If you did not find any one the following necessary packages try to search for and install them.

-> yum install XFree86-xfs
-> yum install ttmkfdir
-> yum install rpm-build cabextract
-> rpmbuild -bb msttcorefonts-2.0-1.spec
-> rpm -ivh /usr/src/redhat/RPMS/noarch/msttcorefonts-2.0-1.noarch.rpm

Configure Pidgin to work with Gmail (GTalk)

Hello every one,
For configuring pidgin to work with gmail (gtalk) you need just the following simple steps :

Open pidgin:

- Accounts Menu - > Add
- Protocol menu : XMPP
- User name : write your id without @ part. example :msa.j
- Domain :
- Resource : empty
- Password : yourpassword & check the remember password box if you want that.

Then go to advanced tab

- Connect Port : 5222
- Connect Server :

Click Add, and Enjoy !