Tareq Alam

i have promises to keep and miles to go before i sleep – Robert Frost

Installing contentmirror in plone October 26, 2008

Filed under: 1 — tareqalam @ 5:16 pm
Tags: , ,

here is what I have done to install contentmirror in plone…

download contenmirror from here: http://code.google.com/p/contentmirror/

read the instructions to install it.. not writing here again the code .. see this link ..

http://code.google.com/p/contentmirror/wiki/Installation

here is the settings.zcml:

<configure xmlns=”http://namespaces.zope.org/zope”
xmlns:db=”http://namespaces.objectrealms.net/rdb”
xmlns:ore=”http://namespaces.objectrealms.net/mirror”>

<!– setup a database connection –>
<db:engine url=”mysql://root@localhost/test”
name=”mirror-db”
echo=”True”/>

<!– associate the database connection to the mirror db structures
<db:bind engine=”mirror-db”
metadata=”ore.contentmirror.schema.metadata”
/>
–>
<!– If Your Running on Plone 2.5, you must uncomment the following line
<include package=”ore.contentmirror” file=”legacy.zcml”/>
–>

</configure>

 

Install:zmysqlda October 26, 2008

Filed under: 1 — tareqalam @ 12:08 pm
Tags: , , , ,

download zMysqlda : http://www.zope.org/Members/adustman/Products/ZMySQLDA

download Mysql- Python : http://sourceforge.net/projects/mysql-python

First install mysql-python

unpack it.Change directory to the unpacked folder

in terminal type:PLONE_PATH/Python-2.4/bin/python setup.py install

There maybe some mysql_config path error

Like: EnvironmentError: mysql_config not found

installing the libmysqlclient15-dev package solved the “mysql_config” problem for me.

Thanks

 

steps to use cron October 25, 2008

Filed under: 1 — tareqalam @ 1:21 pm
Tags: , , , ,

Help Link: Ubuntu Help

What is Cron?

Cron is a daemon used for scheduling tasks to be executed at a certain time. Each user has a crontab file, allowing them to specify actions and times that they should be executed. There is also a system crontab, allowing tasks such as log rotation and locate database updating to be done regularly.

What Is Crontab?

A crontab is a simple text file that holds a list of commands that are to be run at specified times. These commands, and their related run times, are controlled by the cron daemon and are executed in the system’s background. More information can be found by viewing the crontab’s man page.

Assume that you have command and you want to run that command at an specified time

for example I have made a sh file with this line

mkdir /home/tareqCron

saving the file naming tareqFirstCron.sh

from terminal you can test it by running to run it just go to the folder where you saved. Then type:

sh tareqFirstCron.sh

it will create a directory at /home

now delete the directory. we want to create the director at 2 am everynight

Steps to use cron :

1. open terminal

2.type crontab -e. This will open an editor where we can write crontab commands

3.the format of the line is this :

minute (0-59), hour (0-23, 0 = midnight), day (1-31), month (1-12), weekday (0-6, 0 = Sunday), command

for our example we will add this line
00 02 * * * sh /path_to_saved_sh_file/tareqFirstCron.sh

4. Now Press ctrl+O
5. press enter

Now go to sleep by running on the machine .. and wake up at 2 am at night
you will see a directory is created at /home ..
that means the command is executing at fixed time
for more example ask google ..
Thanks

 

Pack ZODB with repozo.py October 25, 2008

Hi I have created a script which will pack zodb. here is the code:

#pack zodb with repozo.py

### CONFIGURATION START ##########
ZOPE_HOME=/home/tareq/Plone-3.1/zeocluster/parts/zope2 # this is the zope home find your zope home #from zmi control panel
PYTHONPATH=$ZOPE_HOME/lib/python # this is the python path that the zope is using
PATH_TO_REPOZOPY=/home/tareq/Plone-3.1/zeocluster/bin/repozo.py # find the repozo.py to find in #terminal type: locate repozo.py
BACKUP_DIRECTORY=/home/tareq/plone/Learning # where you want to keep the backup of data.fs file
PATH_TO_DATAFS_FILE=/home/tareq/Plone-3.1/zeocluster/var/filestorage/Data.fs #this is the path of zodb #database Data.fs

################### N-O N-E-E-D T-O E-D-I-T A-F-T-E-R T-H-I-S L-I-N-E ##############################
export PYTHONPATH #this is needed to be done else repozo.py cant find path

COMMAND_DB_BACKUP=”$PATH_TO_REPOZOPY -BvQ -r $BACKUP_DIRECTORY -f $PATH_TO_DATAFS_FILE” # creating the command here
`${COMMAND_DB_BACKUP}` # this line executes the command

### HOW TO RUN THIS COMMAND ##########

#1. Open Terminal type sh packzodb.sh
#see files created in the BACKUP_DIRECTORY
# Simple ;)

 

Some Test Credit Card Numbers October 24, 2008

I think This will help the developers who are trying to integrate various payment gateway. here is some test credit card names and numbers:

370000000000002 American Express Test Card
6011000000000012 Discover Test Card
5424000000000015 MasterCard Test Card
4007000000027 Visa Test Card
4012888818888 second Visa Test Card
3088000000000017 JCB
38000000000006 Diners Club/ Carte Blanche

Hope this helps

Thanks

 

Ubuntu: mounting external drives forcefully October 17, 2008

Filed under: Ubuntu — tareqalam @ 7:05 am
Tags: , , ,

I am using both XP and ubuntu in 2 separate hard drive in the same pc. Couple of days ago i have installed XP in the secondary hard drive. I dont know why but after that I couldnt mount or see inside my drives where the xp is installed from ubuntu. Then I found help in ubuntu forum.http://ubuntuforums.org/showthread.php?t=603

I am just explaining what I have done:

opent terminal

tareq@User: sudo mount -t ntfs-3g /dev/disk/by-label/drive_name /media/a_directory/ -o force

If the directory is not created in media directory you have to create it first. with the command

tareq@User: sudo mkdir /media/a_directory

then run the above command

hope this works