Archive July 2013

adapt iframe size to window with only css

css :

div#container {
    position: fixed;
    top: 0px;
    left: 0px;
    bottom: 0px;
    right: 0px;
}
div#container iframe {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    width: 100%;
}

html :

   

share folder from ubuntu to windows


We describe here how to share folder in ubuntu within Samba:

  • host : ubuntu
  • host ip : 10.10.3.52

– Edit “smb.conf”

sudo vi /etc/samba/smb.conf 

– Add following :

[myshared]
path = /home/witr/myFolder
available = yes
valid users = witr
read only = no
guest ok = no
browsable = yes
public = yes
writable = yes

– Restart samba:

sudo service smbd restart 

– In windows, mount new drive :
a. choose drive letter,
b. select network->ubuntu->myshared or type \10.10.3.52myshared
c. when request user and password, use one of valid users (here witr)

svn first user commit

print users who commits frst commit for each class in project :

> find -name “*.java” -exec svn log -l1 -r1:HEAD {} ; | grep “|” | awk ‘{print $3}’

print java class name and user who leaves first commit of that class
(user /path_to_java_file/java_file.java) :

> find -name “*.java” | while read line; do user=$(svn log -l1 -r1:HEAD $line | grep “|” | awk ‘{print $3}’); echo $user $line; done;

maven javadoc for only specified classes

Generate javadoc site :

> mvn clean javadoc:javadoc

We can specify classes which we want to be included in the javadoc, for that add in build>plugins section following:

      
        org.apache.maven.plugins
        maven-javadoc-plugin
        2.9
        
                
                        DelegationUtils.java
                
                ${basedir}/src/path_to_package1;${basedir}/src/path_to_package2;
        
      

Note that previous configuration is handled by 2.9 version or prior of maven javadoc plugin
then regenarate java doc :

> mvn clean javadoc:javadoc

sonarQube and sonarRunner + mysql

Analyse sonarQube standalone server :

[MYSQL]
First of all prepare your mysql user sonar :

> mysql -uroot -p

    > use mysql;
    > create user sonar identified by ‘sonar’;
    > update user set host=’%’ where user = ‘sonar’;
    > create database sonar;
    > grant all privileges on sonar.* to sonar;
    > flush privileges;
    > quit

[SOANR QUBE]

– download sonar-x.x.x.zip
– unzip sonar-x.x.x.zip :

> unzip sonar-x.x.x.zip -d /path/where/to/extract/

– declare 
– edit /extracted/sonar/path/conf/sonar.properties
       1. comment     : sonar.jdbc.url:                            jdbc:h2:tcp://localhost:9092/sonar
       2. uncomment : sonar.jdbc.url:                            jdbc:mysql://127.0.0.1:3306/sonar[…]
– start sonar server : > /extracted/sonar/path/bin//sonar.sh start
[SONAR RUNNER]
– download sonar-runner-dist-x.x.x.zip
– unzip sonar-runner-dist-x.x.x.zip :

> unzip sonar-runner-dist-x.x.x.zip -d /path/where/to/extract/

– add environment variable SONAR_RUNNER_HOME: (ubuntu) edit /etc/environment and add SONAR_RUNNER_HOME=/sonar-runner/home/path/ 
– add $SONAR_RUNNER_HOME/bin to PATH : (ubuntu) edit /etc/environment and edit PATH
– go to your project home directory
– create file sonar-project.properties
– copy following in sonar-projetc.properties

# required metadata
sonar.projectKey=witr:project
sonar.projectName=proj
sonar.projectVersion=1.0

# optional description
sonar.projectDescription=Fake description

# path to source directories (required)
sonar.sources=src/main

# The value of the property must be the key of the language.
sonar.language=java

# Encoding of the source code
sonar.sourceEncoding=UTF-8

# Additional parameters
#sonar.my.property=value

– finally analyse your project :

> sonar-runner