mercredi 11 décembre 2013

How to add git remote repository on server

first you connect ssh to your server, then you can set up an empty repository for them by running git init with the --bare option, which initializes the repository without a working directory:

$ cd /var/www/GIT_REPOSITORY
$ mkdir newRemoteProject
$ cd newRemoteProject
$ git --bare init


then you should change the permission into this new remote repository
$chmod -R 777 /var/www/GIT_REPOSITORY/newRemoteProject

Then,all team can push the first version of their project into that repository by adding it as a remote and pushing up a branch. Note that someone must shell onto the machine and create a bare repository every time you want to add a project.

# on Johns computer
$ cd myproject
$ git init
$ git add .
$ git commit -m 'initial commit'
$ git remote add origin http://Server_Adresse/GIT_REPOSITORY/newRemoteProject
$ git push origin master

Note : the path to the remote repository is under /www because i have used gitweb with git over http.

samedi 7 décembre 2013

How to disable JavaScript Validation from Eclipse Project ?



  1. Right click your project
  2. Select Properties -> JavaScript -> Include Path
  3. Select Source tab. ( It looks identical to Java Build Path Source tab )
  4. Expand JavaScript source folder
  5. Highlight Excluded pattern
  6. Click Edit button
  7. Click Add button next to Exclusion patterns box.
  8. You may either type Ant-style wildcard pattern, or click Browse button to mention the JavaScript source by name.
The information about JavaScript source inclusion/exclusion is saved into .settings/.jsdtscope file. Do not forget to add it to your SCM.
Here is how configuration looks with jquery files removed from validation


lundi 2 décembre 2013

Tuckey URL Rewrite


How can we make the web application URL cleaner and prettier instead of showing plenty of URL parameters? Is there a way  for a simple easy solution to do that without configuring the application server like Tomcat? after spending a long time of research and test, i found a tool named  Tuckey URL Rewrite that do exactly what i want.
My needs are the following, i have a java wicket web application with Tomcat 7 as webapp server and want to resolve two problems :

  1. First i would make pretty friend profile link as facebook or Google+, for example applicationName/Firstname.lastname 
  2. Second, i want to implicitly add a dynamic parameter depending on the requested domain name for example :  SuchCustomer.domineName.com should be implicitly transformed to SuchCustomer.domineName.com?CustomertName=SuchCustomer

STEP ONE :

install Tuckey URL Rewrite by adding Maven dependency :
<dependency>
    <groupId>org.tuckey</groupId>
    <artifactId>urlrewritefilter</artifactId>
    <version>4.0.3</version>
</dependency>

STEP TWO :

To WEB-INF/web.xml add :
<filter>
    <filter-name>UrlRewriteFilter</filter-name>
    <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>UrlRewriteFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
</filter-mapping>

STEP THREE :

Add urlrewrite.xml in WEB-INF (src/main/webapp/WEB-INF/ for Maven users)  , this file will contain all our rules. so to meet my needs, i write  this two rules:
<rule>
<note>Clean Friend profile URL</note>
<from>^/([a-z0-9]+)\.([a-z0-9]{1,10})$</from>
<to>/FriendProfile?friendLoginID=$1</to>
</rule>

<rule>
<name>Add parameter to URL</name>
<condition name="host" operator="equal">SuchCustomer.DomainName.com</condition>
<from>^/$</from>
<to>?CustomerName=SuchCustomer</to>
</rule>    

 For more information about this tool, take a look at the official documentation.