Sunday, February 6, 2011

Copy files from local machine to remote server

If you waste the time copying files from your local machine to remote server .


#!/bin/bash
clear

echo '------------< START Uploading Files >------------'
for x in `cat $1`
do
echo ' ---> Copy file ( '$x' ) to Remote Server...'
sshpass -p 'REMOTESERVERPASSWORD' scp -P PORTNUMBER /your/files/path/$x REMOTEUSERNAME@REMOTEIPADDRESS:/your/remote/files/path/$x
done

echo '------------< END Uploading Files >--------------'



How it works :

list your files into text file as below :


admin/test.php
index.php


save the bash file at your local machine with this name : copy_files.sh


Run the bash file :


fadi@fadi-desktop:~/NetBeansProjects$ ./copy_files.sh files_list.txt


-------------------< START Uploading Files >-----------------
---> Copy file ( admin/test.php ) to Remote Server...
---> Copy file ( index.php ) to Remote Server...
-------------------< END Uploading Files >-------------------


DONE !!!!


Sunday, March 29, 2009

Install eclipse 3.4 Gaynmede and connect to SVN repository project

Installing Eclipse 3.4 GANYMEDE :

1. Download the Eclipse 3.4 version from the following website :
http://www.eclipse.org/downloads/
2. Choose the linux 32bit
3. Extract the downloaded file into the following folder : /usr/lib/
4. To make a link for the eclipse create a link to Application icon on the Desktop then link it to the eclipse icon which exists in /usr/lib/eclipse .

Installing Subclipse on Eclipse 3.4 :

1. Open Eclipse.
2. Choose Help Software Updates...
3. Select the Available Software tab, and press the Add Site... button.
4. In the Add Site dialog box, for the Location, enter:
http://subclipse.tigris.org/update/

Type carefully. Case matters. No spaces.
5. Back in the Available Software tab, you will now see some new options.
6. Click Install...
7. Click Next, then click the button to accept the license agreement.
8. It will install automatically (see the progress bar in the lower-right portion of the Eclipse window; wait for it to complete). Then you will need to restart Eclipse.


Connecting to Our SVN through Eclipse :

1. Open SVN Repository window then click on Add SVN Repository icon from the SVN Repository Window tool bar .
2. A Dialog box will be appeared asking for the SVN URL .
3. Right-click on the URL to check out the project into your workspace .
4. Check you navigator window to see the project was checked out there to be synchronized in the future .

Hope it works fine :)


Tuesday, December 30, 2008

How to install Django on kubuntu Linux version

If you have kubuntu Linux version here you are the steps of How to install Django on your Kubutnu :

1. Install MySQL

Django can use multiple database backends, e.g. PostgreSQL, MySQL, SQLite, etc. If you want to use MySQL, you can install it as follows:

$ sudo apt-get install mysql-server mysql-client

During installation you will be asked for Mysql password .

We want MySQL to listen on all interfaces, not just localhost, therefore we edit /etc/mysql/my.cnf and comment out the line bind-address = 127.0.0.1:

$ vi /etc/mysql/my.cnf

[...]
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1
[...]

Then we restart MySQL:

$ sudo /etc/init.d/mysql restart

Now check that networking is enabled. Run

$ sudo netstat -tap grep mysql

The output should look like this:

server1:~# netstat -tap grep mysql
tcp 0 0 *:mysql *:* LISTEN 3085/mysqld
server1:~#

The following commands is used to change Mysql password :

Run

mysqladmin -u root password yourrootsqlpassword
mysqladmin -h server1.example.com -u root password yourrootsqlpassword

to set a password for the user root (otherwise anybody can access your MySQL database!).

2. Install Apache And mod_python

If Apache2 and mod_python aren't already installed on your system, you can install them as follows:

$ sudo apt-get install apache2 apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-python

3. Install Django

In order to install Django and the Python MySQL bindings, we run:

$ sudo apt-get install python-django python-mysqldb

4. Create Django web Application

we must create a Django project (e.g. called mysite) (see http://www.djangoproject.com/documentation/tutorial01/).

$ sudo ln -s /usr/share/python-support/python-django/django/bin/django- admin.py /usr/local/bin/django-admin.py

$ sudo chmod +x django-admin.py

$ sudo django-admin.py startproject mysite

$ cd mysite
$ python manage.py runserver
Validating models...
0 errors found.

Django version 0.96.1, using settings 'mysite.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

Open http://127.0.0.1:8000/ in your browser :)

It Worked :D

5. Connect To A MySQL Database From A Django Project

If you want to use a MySQL database in your Django project, you should first create that database (e.g. mysite) and a database user (e.g. mysiteadmin) for that database:

$ mysql -u root -p

CREATE DATABASE mysite;
GRANT ALL ON mysite.* TO 'mysiteadmin'@'localhost' IDENTIFIED BY ' mysiteadmin_password';
GRANT ALL ON mysite.* TO 'mysiteadmin'@'localhost.localdomain' IDENTIFIED BY 'mysiteadmin_password';
FLUSH PRIVILEGES;
quit;

Then open the settings.py file in the project folder (e.g. /home/mycode/mysite) and modify the database settings, e.g. as follows:

$ sudo vi /home/mycode/mysite/settings.py

[...]
DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
DATABASE_NAME = 'mysite' # Or path to database file if using sqlite3.
DATABASE_USER = 'mysiteadmin' # Not used with sqlite3.
DATABASE_PASSWORD = 'mysiteadmin_password' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
[...]

That's it , such as driving your car on the highway . . .