Archive May 2013

have your GIT server


=========================================== 31/05/2013
GIT:
Consists of two repository. one on server side and the other in client side (clone of server side repos).
When client commits, modifications were saved to client side repository
To send modifications to server, client must push commits.

1. install and configure git server
2. create server git repository
3. access to remote git repo with eclipse
4. explore git repository with gitk

1. install and configure git server:
sudo apt-get install git-core
git config –global color.diff auto
git config –global color.status auto
git config –global color.branch auto
git config –global user.name “mabrouk”
==> see your config in vim ~/.gitconfig

2. create server git repository
cd /home/mba
mkdir mbaGitRepo
cd mbaGitRepo
git init –bare

3. access to remote git repo with eclipse
Window->Show View->git Repositories
click on icon “Clone a Git Repository and add the clone to this view”
– Host : your host
– Repository path : ~/mbaGitRepo
– Conection : Protocol ssh / Port 22
– user: linux username (mba)
– password : linux user password
click Next
don’t worry of warning : Source Git repository is empty
click Next
Directory : Choose where you want clone the remote git repository in your local machine
click Finish

4. explore git repository with gitk
install gitk : sudo apt-get install gitk
launch gitk  : gitk

exception: Can’t connect to X11 window server using ‘:0’ as the value of the DISPLAY variable


=========================================== 30/05/2013
If you have following error: Can’t connect to X11 window server using ‘:0’ as the value of the DISPLAY variable.
you must know that :
– linux user (launching process requsting Xserver) is not authorized to access Xserver
– OR DISPLAY variable is bad configured

type xhost to know:

> xhost
No protocol specified
No protocol specified
xhost:  unable to open display “???”
==> means you don’t have authorization to any Xserver
==> to authorize access type: > sudo xhost +SI:localuser:youruser

> xhost
xhost:  unable to open display “???”
==> means DISPLAY variable is bad configured
==> you must fix DISPLAY variable. type: > export DISPLAY=hostname:D.S
– hostname is the name of the computer where the X server runs. An omitted hostname means the localhost.
– D is a sequence number (usually 0). It can be varied if there are multiple displays connected to one computer.
– S is the screen number. A display can actually have multiple screens. Usually there’s only one screen though where 0 is the default.

look for class name in several jar files


=========================================== 28/05/2013
look for class name in several jar files:
ll path-to-jars/ | awk {‘print “path-to-jars/”$9’} | grep “.jar” | while read thejar; do echo $thejar; jar -tvf $thejar | grep “yourClassName pattern”; done
previous command line will echo each jar file name and then classes that names matches your pattern

allow remote debug for jboss7


=========================================== 27/05/2013
allow remote debug for jboss7
(https://community.jboss.org/thread/175385)
1. Check the standalone.conf (or standalone.conf.bat for Windows OS) and uncomment the following line:
#JAVA_OPTS=”$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n”

setup hsqldb with jboss7

jboss7 comes with h2 already installed and setup.
For hsqldb, just take h2 setup as example.

Following steps helps to setup hsqldb with jboss7.

A. create new jboss7 module: hsqldb module

1. first create directory $JBOSS_HOME/modules/org/hsqldb/main

cd $JBOSS_HOME
mkdir -p modules/org/hsqldb/main

2. download hsqldb and put the hsqldb.jar into created directory main
3. create into main directory following module.xml file (assuming hsqldb jar is hsqldb-x.x.x.jar)



  
    
  
   
     
     
   

B. setup hsqldb datasource

1. add hsql driver by editing $JBOSS_HOME/standalone/configuration/standalone.xml (locate drivers in standalone.xml file)

  
    
  ...  

2. finally add hsqldb datasource in $JBOSS_HOME/standalone/configuration/standalone.xml (locate datasources in the file)
we consider a file hsqldb database created into /home/hsqldb/data/witrHsqldb

  
    
    jdbc:hsqldb:file:/home/hsqldb/data/witrHsqldb
    
    
    hsqldb  
    
    
    false  
    false  
    FailingConnectionOnly  
    
    
      
      sa  
      
      
      
    

tar exclude

May 16, 2013

pour exclure un dossier du tar créé:
soit le dossier : /home/fol
qui contient
/home/fol/data1/
et /home/fol/data2/
et /home/fol/tmp1/
et /home/fol/tmp2/

on veut faire un tar de “fol” en excluant les dossier “tmp1” et “tmp2”:
cd /home
tar -czvf fol.tgz fol –exclude ‘fol/tmp1’ –exclude ‘fol/tmp2’

et le tour est joué