java

Java (Indonesian: Jawa; Javanese: ꦗꦮ) is an island of Indonesia. With a population of 143 million, Java is the world's most populous island, and one of the most densely populated places in the world. [read more at http://en.wikipedia.org/wiki/Java]

  • eclipse_indigo_aka_3_7

    Eclipse Indigo is the annual release of Eclipse projects on June 22 2011; this year 62 project teams are part of the release.

    New and Noteworthy

    JBossTools

     
  • The PDT project is working towards providing a PHP Development Environment framework. This project was formerly known as PHP IDE.

    Make Eclipse PDT work for Joomla development

    Install a PHP debugger

    In order to be able to perform debugging using eclipse PDT, you must download one of the following extra packages:&160; XDEBUG or ZEND debugger. I was not able to get the debugger running with XDEBUG even after reading many tutorials and trial error approach. Both packages are free, and it has work nicely for me with ZEND debugger after 5 minutes...

    Unfortunately, XDEBUG/ZEND can not be packaged with PDT due to license restrictions, so both tools are not just running out of the box without few efforts.

    PDT and Zend Debugger

    Download

    PDT + Zend in one package thanks to Zend.com (118MB), highly recommended

    OR PDT (105MB) and add Zend debugger through software update later

    • Open Eclipse and go to Help-> Software Updates-> Find and Install
    • Select "Search for new features to install" and click "Next"
    • Create a New Remote Site with the following details:
    • Name: PDT
    • URL: http://downloads.zend.com/pdt
    • Check the PDT box and click "Next" to start the installation

    XAMPP, Zend debugger working together

    open the php.ini located at \xampp\apache\bin\php.ini

    and add the following

    [DEBUGGER]
    zend_extension_ts=
    E:\php\bin\eclipse\plugins\org.zend.php.debug.debugger.win32.x86_5.2.15.v20081217\resources\php5\ZendDebugger.dll
    zend_debugger.allow_hosts=127.0.0.1/192.168.1.100
    zend_debugger.expose_remotely=always

    Notes:

    • Only one key zend_extension_ts is allowed per php.ini file, un-comment all other or it wont work,
    • Attention: I did not move ZendDebugger.dll but use the one coming with eclipse Zend plugin, this may cause issues, if you update this plugin and the path change...

    Restart XAMPP apache

    By going to http://localhost/xampp/phpinfo.php check that you have a section Zend Debugger

    zend.debugger.active.in.xampp

    Put now a breakpoint in index.php of any Joomla! installation or deeper in any component you want to debug

    And right click on index.php, debug as PHP Web Page (Alt-Shift-D, W)

    Attention

    While the first page get properly rendered in the internal browser of eclipse PDT, I was getting some strange rendering issues (html code produced look fine), by using an external browser like Chrome, Firefox, the problem has disappear.

    PDT and XDebug

    Installing with PEAR/PECL is as easy as opening a command prompt and typing

    # \xampp\php\pecl install xdebug

    open the php.ini located at \xampp\apache\bin\php.ini

    and un-comment the following

    extension=php_xdebug.dll

    and

    [XDebug]
    ;; Only Zend OR (!) XDebug
    zend_extension_ts="e:\xampp\php\ext\php_xdebug.dll"
    xdebug.remote_enable=1
    xdebug.remote_host=localhost
    xdebug.remote_port=9001
    xdebug.remote_handler=dbgp
    xdebug.profiler_enable=0
    xdebug.profiler_output_dir="\xampp\tmp"

    Caveats:

    1. Modify the correct php.ini file, check the page phpinfo, normally the right php.ini is located at \xampp\apache\bin\php.ini
    2. You need to comment out any other references to &8220;zend_extension_ts&8221; in the php.ini file (the zend optimizer use it already as default)
    3. Restart apache, and check the page http://localhost/xampp/phpinfo.php to make sure XDebug has been successfully installed

    debugging AkoBookPlus:

    debugging.joomla.components

    &160;

    Add subversion plugin

    Install subversive by pointing the update manager to subversive update site

    svn.subversive.install

    You need also to install SVN connectors by adding a new update site:

    http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/ - [required] Subversive SVN Connectors

    svn.subversive.install.connector&160;

    Eclipse will restart, you should be able to browse www.joomlaCode.org repositories.

    Happy Joomla! development and PHP debugging!

  • My platform of development is Suse 9.0 and Eclipse 3.0M4

    eclipse launcher (link)

    The best eclipse launcher available as today, written in smalltalk by my friends of www.xdreamteam.ch

    xdt Eclipse Launcher V1.0 RC2(761 KB) ist ein Tool für Java-Entwickler die mit Eclipse arbeiten.Mit dem xdt Eclipse Launcher verwalten Sie ihre Workspaces und können diese von einem Ort aus starten. Der xdt Eclipse Launcher startet als System-Tray Program, von wo Sie die Möglichkeit haben neue Definitionen einzutragen, oder die bestehenden Definitionen einfach und schnell zu starten.

    HP Nimius/E3 launcher

    Plugin for starting a HP Nimius application, Hewlett Packard Nimius informations can be found at www.hpnimius.com This plugin was originally developped at work, and has been totally rewritten to avoid any copyright infrigment.
    Why is the difference with a Eclipse Launcher? you have 3 icons...

    Installation:

    Prerequisite:
    This plugin assume that you are using a project for E3 which have the following structure (but you can change the default location of components):

         
    Project XXX/etc contains xml files, properties  
    Project XXX/log    
    Project XXX/lib contains applications E3 services and java code  

    Greetings:
    This plugin is based on Tomcat sysdeo plugin and was simply extended. Since the original code is based on the MIT licence, I am also giving you this code under the same conditions.

    The MIT Licence:
    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
    conditions:
    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

     

     

    Tutorials:

    http://www.awprofessional.com/articles/article.asp?p=31789&seqNum=1

    FAQ:

     

    Starting Tomcat in eclipse

    i get the following exceptions:

    2004-07-14 14:40:55,540 0 [main] ERROR org.apache.commons.digester.Digester - Digester.getParser:
    javax.xml.parsers.ParserConfigurationException: AElfred parser is namespace-aware
    at com.icl.saxon.aelfred.SAXParserFactoryImpl.newSAXParser(SAXParserFactoryImpl.java:37)
    at org.apache.commons.digester.Digester.getParser(Digester.java:686)
    at org.apache.commons.digester.Digester.getXMLReader(Digester.java:902)
    at org.apache.commons.digester.Digester.parse(Digester.java:1548)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:449)
    at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
    at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203

     

    "With tomcat 4.x, things become simpler, but this version of tomcat uses the jaxp sax parser factory. Moreover, this version of tomcat requires a validating parser, and it doesn"t check whether the parser actually is validating. If the AElfred parser is supplied in the system properties, an exception will be thrown when tomcat attempts to set validating on. I"d recommend using the (validating) xerces 1.4.4 sax parser rather than AElfred parser. It"s not safe to rely on the default parser, by not setting system properties, because it"s very likely there are several versions of the JAXP classes in the classpath, and who knows when you might get another one. The practice by the distributors of XML tools to include implementations of the JAXP classes in their own jar files is, of course, rather insane, but that"s the way it is.

    Do this,
    System.setProperty("javax.xml.parsers.SAXParserFactory",
    "org.apache.xerces.jaxp.SAXParserFactoryImpl");=20
    but also do this
    System.setProperty("org.xml.parsers.sax.parser",
    "org.apache.xerces.parsers.SAXParser");=20
    since many third party tools base the parser choice on =
    "org.xml.parsers.sax.parser" rather than use the SAXParserFactory.

    Regards,
    Daniel Parker
    http://presentingxml.sourceforge.net/"

    in eclipse add the following key to the launcher in VM arguments

    -Djavax.xml.transform.TransformerFactory=com.icl.saxon.TransformerFactoryImpl -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
    -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
    -Dorg.xml.parsers.sax.parser=org.apache.xerces.parsers.SAXParser

     

     

     

  • maven-logo-2 eclipse

    I did develop this solution at work for our internal purpose at www.innoveo.com. Going away from the paradigm “As a developer I run everything locally” isn’t easy to accept but in some rare cases, it make sense. Below I list what I consider to be the main advantages and drawbacks.

    Stability

    • Not everybody is changing the developer environment as you need admin right to be able to do changes, more stability.
    • The developer environment is standardized: convention over configuration always pays like in Apache Maven.

    Sharing

    • you can work from anywhere as long as you have an internet/VPN connection
    • You can move your working place around, show your workspace to a colleague, reduce your coupling to Windows, use Linux, use a Mac!

    Security

    • The source code stay on the server, if someone steal notebooks you don’t loose your software assets.

    Efficiency

    • Somebody maintains the developer environment and settings for you, some developers can still beta test a new eclipse version before till it is considered stable.
    • Rollout is limited to a minimum loss of time, as you will see below 
    • Setting up a new developer account is basically settings up a new account on the shared server, running 3 lines of shell.
    • The server  is not full of unwanted applications running in background, only java.exe. eclipse.exe, databases can still run on another server (MYSQL, Oracle), runtime environment (Tomcat).

    Speed, speed and speed

    • A server is cheap compare to one big notebook for every developer.
    • Server is most of the time fully 64bits, may have up to 8 cores, RAID 5 typically  output 350Mb/s read (a good notebook: 32 bits, 2 cores and 80Mb/s without SSD)

    Drawbacks

    • A shared developer environment is a Single point of failure –> you need a very good backup, and eventually hardware fallback machine in hot standby!
    • You can not work if developer have no or limited internet access, in train for example.
    • It required a bit of initial engineering, hence this article.

    Access

    Windows

    Use Windows Remote desktop connection, define a DNS entry to access the server.

    remote.desktop

    Linux

    Linux has a free remote desktop implementation of Microsoft protocol, if it not installed, run either on Debian

    # apt-get install rdesktop

    or in OpenSuSE

    # zypper install rdesktop

    or in RED HAT

    # yum install rdesktop

    Create a script .sh file to save the connection parameters:

    rdesktop -A -C -k de-ch -r PRIMARYCLIPBOARD -u username -p password -xl  ipadress

     

    Eclipse

    One install for all users

    1. Unpack the latest eclipse in any location, I recommend on c:\eclipse-3.5, but any location where you have some space will work.
    2. Start eclipse as administrator and install all required 3r party plugin: we use M2Eclipse, Subversive for example.
    3. Stop Eclipse,
    4. Remove ALL write rights to ALL users including admin if needed.
    5. When Eclipse will start under a developer account, it will copy its configuration files into C:\Users\%USERNAME%\.eclipse
    6. Every users will be able to adjust the eclipse.ini but these settings are a good start (adapt memory to your requirements)
    7. Create a shortcut for every developer on their desktop pointing to c:\eclipse\eclipse.exe

    C:\Users\cedric.walter\.eclipse\org.eclipse.platform_3.5.0_1770938306\configuration\eclipse.ini

    -startup
    plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
    --launcher.library
    plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.0.200.v20090519
    -showsplash
    org.eclipse.platform
    --launcher.XXMaxPermSize
    256m
    -configuration
    ../Users/cedric.walter/.eclipse/org.eclipse.platform_3.5.0/configuration
    -Dfile.encoding="UTF-8"
    -vmargs
    -Xms2048m
    -Xmx2048m
    -XX:PermSize=256m
    -XX:MaxPermSize=256m
    -XX:+UseParallelGC

    Updating Eclipse

    A rollout of new Eclipse version is easy thanks to symbolic link. Download junction.exe, a small tool to create symbolic links

    Windows 2000 and higher supports directory symbolic links, where a directory serves as a symbolic link to another directory on the computer.

    and run as admin

    junction.exe c:\eclipse c:\eclipse-3.5

    Now thanks to symbolic links any update to a major new version of eclipse will be plain easy: just delete the symbolic link c:\eclipse and create a new one to the new version!

    Users with Multiple Eclipse workspaces

    1. Create an empty directory for hosting your new workspace, for example at
          e:\%USERNAME%\workspace\maven
    2. Create a new shortcut with this content
      C:\eclipse\eclipse.exe --launcher.ini
      "C:\Users\\%USERNAME%\.eclipse\org.eclipse.platform_3.5.0_1770938306\configuration\eclipse.ini"
      -data e:\\%USERNAME%\workspace\maven

    Apache Maven

    Maven Local repository, every user has it’s own

    It is not recommend to share the local Maven repository cache among users as Maven has no locking concept in place. The local maven repository is expected to be located at

    c:\users\%USERNAME%\.m2\repository

    If you have enough space there for all your users, you can skip that chapter, Otherwise I will show you how to locate it anywhere on the file system.

    Let’s store it at e:\%USERNAME%\repository, here I have choose another drive with more space as Maven local repository can be quite big (700Mb per user today)

    The design chosen impose me to one more time play with symbolic links, using junction.exe in c:\users\%USERNAME%\.m2\repository pointing to e:%USERNAME%\repository

    When you are logged in as a normal developer account, in a dos windows, run the following

    junction.exe c:\users\%USERNAME%\.m2\repository e:\%USERNAME%\repository

    Maven settings.xml, one for all users

    I like the idea to maintain only one settings.xml. Apache Maven recommend to have one settings.xml per user (located in c:\users\%USERNAME%\.m2\settings.xml). This is true if you have different responsibilities among all your developers. For example some may not be able to deploy in Artifactory/Nexus while other can. Luckily, this is not the case as for today in our company. That is why I will only have one Settings.xml on server, located at c:\server.xml

    I will use a hard link to c:\settings.xml. When you are logged in as a normal developer account, in a dos windows, run the following

    fsutil hardlink create c:\users\%USERNAME%\.m2\settings.xml c:\settings.xml

    This make Apache Maven think that the settings.xml is in the default location c:\users\%USERNAME%\.m2\

    Updating Maven

    I do use the same trick for having a unique version of maven binary on the server while keeping some flexibility thanks to symbolic links.

    1. Unpack Apache Maven anywhere
    2. As an admin, in a dos windows, run the following:
      junction.exe c:\maven-3.0-beta1 c:\maven

    Now you can let all your developer reference in M2Eclipse this virtual directory c:\maven. Switching all developers to a new version is done by deleting and pointing to an older/newer version of Maven.

    It is not finished

    Our shared developer environment setup also virtualizes MYSQL (multiple schema per developer ) and Tomcat (per developer port range) using –D system variables in eclipse.ini

    References

    Scenario 2 - shared install

    In this scenario, a single install area is shared by many users. The "configuration" directory under the install area is home only to the config.ini as shipped with the product (it is not initialized). Every user has their own local standalone configuration location.

    The set up for this scenario requires making the install area read-only for regular users. When users start Eclipse, this causes the configuration area to automatically default to a directory under the user home dir. If this measure is not taken, all users will end up using the same location for their configuration area, which is not supported.

  • Eclipse version 3.1 is AVAILABLE. New features added in this release: full support for Java 5.0 and improved support for developing rich client applications. Performance has been also significantly enhanced across the board since the 3.0 release. (what a blast with Jrockit 1.4.2!!!) . SWT can make a lot more graphical tricks, and has more widgets
    Do not forget to read what is maybe the best documentation online: 
    New and Noteworthy, (because You can get the substance of the new features in very few pages)
  • I came across this article at IBM developerworks, which explain how to use the RDT: Ruby IDE for the Eclipse platform. I decide also to give You here an overview of all languages supported by eclipse:

    • JDT: The JDT project provides the tool plug-ins that implement a Java IDE supporting the development of any Java application, including Eclipse plug-ins. It adds a Java project nature and Java perspective to the Eclipse Workbench as well as a number of views, editors, wizards, builders, and code merging and refactoring tools. The JDT project allows Eclipse to be a development environment for itself.

    • RDT is an open source Ruby IDE for the Eclipse platform.
      Features supported are syntax highlighting, on the fly syntax check, graphical outline, Test::Unit view/runner, Ruby application launching, content assist, source formatter, and a Ruby debugger.

    • CDT (C/C++ Development Tools) Project is working towards providing a fully functionalC and C++ Integrated Development Environment(IDE) for the Eclipse platform. 

    • Cobol: Eclipse fundation is hosting one COBOL CDT project but there is also a commercial plugin: theACUCOBOL-GT Eclipse Plug-in,

    • PHP:   PHPeclipse (open source CPL) PHP parser, debugger, code formatter, outline view, templates. Note also that ZEND has joined the eclipse board, so their flagship product ZEND Studio Pro may have a future as an eclipse plugin.

    • PERL: EPIC is an opensource Perl IDE for the Eclipse platform. Features supported are syntax highlighting, on the fly syntax check, content assist, perldoc support, source formatter, templating support and a Perl debugger. A regular expression plugin and support for the eSpell spellchecker are also available.

    • Python: PyDev is a plugin that enables users to use Eclipse for Python and Jython development. It comes with many goodies such as code completion, syntax highlighting, syntax analysis, refactor, debug and many others.
    • Eiffel: The Eclipe Eiffel Development Tools (EDT) are a set of plugins which eventually implement a full-fledged, highly integrated Eiffel development environment based on the Eclipse Platform
    • Groovy: The plugin provides a Groovy editor for editing scripts or classes in Groovy (Groovy is an object-oriented programming language designed for the Java platform as an alternative to Java with features from Python, Ruby and Smalltalk. see WikiPedia) language. Groovy makes writing scripts and applications for the Java Virtual Machine fast and easy.
    • Microsoft C#: Improve C# code editing with: Creation of new C# files (with a basic structure) - Syntax highlighting - Content assistant for C# keywords - Auto-indentation - C# code compilation etc  Unfortunately no more active development since June 2004

    And the list goes on......beside this nearly all minor scripting languages are supported (jsp, javascript... for ex.) and minor markup language (XML, HTML, JSF...) with the tremendous list of plugins:

    • www.eclipseplugincentral.com Eclipse Plugin Central (EPIC) offers the Eclipse community and users of IBM WebSphere Studio application development environments (WSAD, WSSD, WSED, etc.) a convenient, information-rich portal that helps software developers find open source and commercial Eclipse plug-ins, tools, and products that enhance the entire Java software development life-cycle.
    • eclipse-plugins.2y.net
  • We are working since 3 days on tuning a big application: 

    • Client server enterprise grade application,
    • Run on 2 JVM  with 4Gb (Tomcat/Application server) of RAM each!
    • Run on 2 Double core AMD 64 bits server,
    • Linux 64bits,
    • Has a lot of parallel users and > 10000 are registered
    • Use a product meta model which separate definition from implementation data.
    • Java server faces, java, ajax
     This application  is just consuming too much memory for the offline version. Our objective is to make that big application run

    • The same code as above,
    • In windows XP, 
    • IBM T40,  Intel Pentium M 1.6 GHz,  DDR266/PC2100
    • 1 JVM with 500Mb in Tomcat,
    • 1 GB of physical Ram,
    • 1 Desktop user who may run also Lotus Notes, Microsoft Office at the same time...
    There is already a lot of good resources and valuable advices on internet (Google is your friend :-)). Before digging in the code, and since the code is already productive,  we have done some tuning on component first.
    By tuning each components involved one after the other, this follow the principle: Lets do some quick win first before changing algorithm and increasing risk of breaking something....
    In order to back up each changes made with some statistics, the first step was to develop a testcase with Web Stress Tool(Commercial) but Apache JMETER (... replace with your favorite web testing tool) would have do the job

    At the OS Level

    by trying to convince the company to turn the anti virus off on some files and directory. They were scanning XHTML, javascript, XML, class files, images, so nearly everything... during EACH file access. Note the user has no windows right to alter files.


    MySQL 5(we are already using the latest 5.X branch by luck)

    By removing TCP database access and using name pipe only (+30 to +50% performances),

    By Installing MySQL Enterprise Advisor and Monitor. (You can request a free trial key here) and looking at what the advisor recommend. Attention this tool has been developed for monitoring servers, some recommendations are simply not always usable. In our case we are constrained by the memory, remember less than 500Mb, so we did not blindly follow advices. Basic stuff were done, like adding indexes (were it make sense to avoid full tables scan and reduce slow queries), increasing  buffers,

    By switching to myISAM (multi threaded with table locking) instead of innoDB (multi threaded with row locking), and also avoiding other storage engine to run with different algorithm to run in parallel..

    MyISAM is the default storage engine for the MySQL relational database management system. It is based on the older ISAM code but has many useful extensions. In recent MySQL versions, the InnoDB engine has widely started to replace MyISAM due to its support for transactions, referential integrity constraints, and higher concurrency.Each MyISAM table is stored on disk in three files. The files have names that begin with the table name and have an extension to indicate the file type. MySQL uses a .frm file to store the definition of the table, but this file is not a part of the MyISAM engine, but instead is a part of the server. The data file has a .MYD (MYData) extension. The index file has a .MYI (MYIndex) extension. [WikiPedia]

    InnoDB is a storage engine for MySQL, included as standard in all current binaries distributed by MySQL AB. Its main enhancement over other storage engines available for use with MySQL is ACID-compliant transaction support, similar to PostgreSQL, along with declarative referential integrity (foreign key support). InnoDB became a product of Oracle Corporation after their acquisition ofInnobase Oy, in October 2005. The software is dual licensed. It is distributed under the GNU General Public License, but can also be licensed to parties wishing to combine InnoDB in proprietary software. [WikiPedia]

    What are the differences, and you may want also to use myISAM for mono user applications...
    1. InnoDB recovers from a crash or other unexpected shutdown by replaying its logs. MyISAM must fully scan and repair or rebuild any indexes or possibly tables which had been updated but not fully flushed to disk. Since the InnoDB approach is approximately fixed time while the MyISAM time grows with the size of the data files, InnoDB offers greater perceived availability and reliability as database sizes grow.
    2. MyISAM relies on the operating system for caching reads and writes to the data rows while InnoDB does this within the engine itself, combining the row caches with the index caches. Dirty (changed) database pages are not immediately sent to the operating system to be written by InnoDB, which can make it substantially faster than MyISAM in some situations.
    3. InnoDB stores data rows physically in primary key order while MyISAM typically stores them mostly in the order in which they are added. This corresponds to the MS SQL Server feature of “Clustered Indexes” and the Oracle feature known as "index organized tables." When the primary key is selected to match the needs of common queries this can give a substantial performance benefit. For example, customer bank records might be grouped by customer in InnoDB but by transaction date with MyISAM, so InnoDB would likely require fewer disk seeks and less RAM to retrieve and cache a customer account history. On the other hand, inserting data in orders that differ substantially from primary key (PK) order will presumably require that InnoDB do a lot of reordering of data in order to get it into PK order. This places InnoDB at a slight disadvantage in that it does not permit insertion order based table structuring.
    4. InnoDB currently does not provide the compression and terse row formats provided by MyISAM, so both the disk and cache RAM required may be larger. A lower overhead format is available for MySQL 5.0, reducing overhead by about 20% and use of page compression is planned for a future version.
    5. When operating in fully ACID-compliant modes, InnoDB must do a flush to disk at least once per transaction, though it will combine flushes for inserts from multiple connections. For typical hard drives or arrays, this will impose a limit of about 200 update transactions per second. If you require higher transaction rates, disk controllers with write caching and battery backup will be required in order to maintain transactional integrity. InnoDB also offers several modes which reduce this effect, naturally leading to a loss of transactional integrity. MyISAM has none of this overhead, but only because it does not support transactions. [WikiPedia]
    For us the speed of myISAM is clearly balancing the drawback for a desktop applications.

    JSF tuning

    Obvious settings here:, JSF is lacking more fine tuning settings. Serialization is occurring during the model life cycle and consume memory and CPU. We may dig deeply later.
    • javax.faces.STATE_SAVING_METHOD to server
    • org.apache.myfaces.COMPRESS_STATE_IN_SESSIONto true since memory is the biggest constraint for us
    • org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION to 0
    • facelets.BUFFER_SIZE to 8192

    Tomcat tuning

    Nothing big can be done here...For me Tomcat is really missing a dynamic web application loader:  Tomcat is simply installing all applications found in /webapps at startup even if they are not used. They are never remove from memory or serialized to disk. Tomcat 4.1 seems to have a memory footprint of 22 Mb, going to the latest Tomcat 6.0 is a too big changes for us now, but we might reconsider it in the future. Removing java library which are not use from WEB-INF/libby trial and error can save some precious Bytes through as it is pretty common when you use frameworks to have jar not desired. For example: junit.jar, jdbc drivers, jms.jar,...Moving common lib to shared/lib may also help remove duplicate jars from webapps class loader and memory.


    JVM tuning

    Java 1.5 and java 1.6 have made a lot of progress, and the JIT compiler found in JAVA 1.5/1.6 is getting  more and more aggressive...The basic rule is to turn the GC JVM log on (by adding -Xloggc:<file> [-XX:+PrintGCDetails]) and analyze it offline with a tool like GCViewer (free). The JIT is doing a pretty good job as the application run more and more faster with the time, but it is just a feeling ;-)
    By analyzing the GC logs we were able to optimize and avoid big mis configurations mistakes, one more time a lot of articles and books are available on how to tune a JVM. Sadly java has no advisor at the moment or is not using genetic algorithms to tune itself...It remains a dream for now.

    By using an empiric approach, which means:
    1 changing JVM parameters -> running test cases ->deciding if we give CPU away or minimize RAM usage -> go back to 1

    We come down to the following  exotic parameters (Xms and Xmx are not of any help since it is really depending on your application and how memory is managed internally)

     -XX:+AggressiveOpts -XX:-UseConcMarkSweepGC

    By the way I use them in Eclipse + JDK 1.6 since months. This page A Collection of JVM Options compiled by: Joseph D. Mocker (Sun Microsystems, Inc.) has been of a great help during this stage.

    Still not enough, we were forced to profile the java code and make some big changes....
  • Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.



    Source Code

    /**
     * Knows which subsystem classes are responsible for a request.
     * Delegates client requests to appropiate susystem objects.
     * @role __Facade
     */
    public class Facade {
            /** reference to particular subsystem */
            private SubsystemA theSubsystemA;        /** reference to particular subsystem */
            private SubsystemB theSubsystemB;        /** this method is called by client */
            public void facadeMethod() {
                    // multiple subsystems could be involved
                    // to provide some functionality
            }
    }
    
    /**
     * Implements subsystem functionality. Handles work assigned by the Facade object.
     * Has no knowledge of the facade.
     * @role __System
     */
    public class SubsystemA {
            /** some functionality */
            public void subsystemFunctionality() {
            }
    }
    
    /**
     * Implements subsystem functionality. Handles work assigned by the Facade object.
     * Has no knowledge of the facade.
     * @role __System
     */
    public class SubsystemB {
            /** some functionality */
            public void subsystemFunctionality() {
            }
    }
  • apache_maven

    This issue has turn me upside down a long time. In fact in the official Google Group http://groups.google.de/group/maven-for-php/ I was not the only one to have this issue.

    I did try the following, and it is always good to check first

    • Checking PHP version,
    • Starting Maven with -X for having more debug information
    • Testing it in Eclipse + M2Eclipse on windows, was working there,
    • Comparing calculated PHP include path on Windows and Linux: they were identical in this case

    Only my Linux box was not working. . .(http://teamcity.waltercedric.com)

    After that I did materialize the eclipse project of maven-php-plugin and even built a custom version that I’ve deployed without any effort to my Artifactory (http://maven.waltercedric.com)

    And what is the solution?

    it my server configuration and paranoia :-)

    open your php.ini, ideally the right one, don’t put your server at risks: You may have many under Linux, especially if you use plesk or cpanel 

    • cli at /etc/php5/cli/php.ini
    • apache2, /etc/php5/apache2/php.ini
    • fastcgi at /etc/php5/fastcgi/php.ini

    location most of the time

    /etc/php5/cli/php.ini

    and add the directory where your build server make a checkout...

    ; open_basedir, if set, limits all file operations to the defined directory
    ; and below.  This directive makes most sense if used in a per-directory
    ; or per-virtualhost web server configuration file. This directive is
    ; *NOT* affected by whether Safe Mode is turned On or Off.
    open_basedir = /www/vhosts:/tmp:/xxxx/yyyy/

    Next step is to put Joomla! 1.6 and all their PHPUnit tests a run along with Selenium. May also need to  patch Maven for PHP to better support Tests reporting like Surefire.

  • Use sharing to support large numbers of fine-grained objects efficiently.




    Source Code

    /**
     * Declares an interface through which flyweights can receive and act on
     * extrinsic state.
     * 
     * @role __Flyweight
     */
    public interface Flyweight {
    	void sampleOperation(FlyweightContext context);
    }
    
    /**
     * Represents extrinsic state of flyweight(s).
     * 
     * @role __State
     */
    
    public interface FlyweightContext {
    }
    
    /**
     * Implements the Flyweight interface and adds storage for intrinsic state, if
     * any. Objects of this class must be sharable. Any state it stores must be
     * intrinsic (independent of this object's context)
     */
    
    public class ConcreteFlyweight implements Flyweight {
    	public ConcreteFlyweight(Object key) {
    		// initialize internal state
    	}
    
    	/** @see patterns.gof.flyweight.FlyweightsampleOperation(FlyweightContext) */
    	public void sampleOperation(FlyweightContext context) {
    		// provide implementation here
    	}
    }
    
    /**
     * Creates and manages flyweight objects. Ensures that flyweights are shared
     * properly. When a client requests a flyweight, this factory supplies an
     * existing instance or creates one, if none exists.
     * 
     * @role __Factory
     */
    
    public class FlyweightFactory {
    	private HashMap flyweight;
    
    	public FlyweightFactory() {
    		flyweight = new HashMap();
    	}
    
    	public Flyweight getFlyweight(Object key) {
    		if (flyweight.containsKey(key)) {
    			return (Flyweight) flyweight.get(key);
    		} else {
    			Flyweight newFlyweight = new ConcreteFlyweight(key);
    			flyweight.put(key, newFlyweight);
    			return newFlyweight;
    		}
    	}
    
    	/**
    	 * @return new instance ofunshared flyweight
    	 */
    	public Flyweight getUnsharedConcreteFlyweight() {
    		return new UnsharedConcreteFlyweight();
    	}
    }
    
    /**
     * Not all Flyweight subclasses need to be shared
     */
    
    public class UnsharedConcreteFlyweight implements Flyweight {
    	/** @see patterns.gof.flyweight.FlyweightsampleOperation(FlyweightContext) */
    	public void sampleOperation(FlyweightContext context) {
    		// provide implementation here
    	}
    
    }
    
  • The version 8.0rc2 is available here
    FreeMind is a premier free mind-mapping software written in Java. The recent development has hopefully turned it into high productivity tool. We are proud that the operation and navigation of FreeMind is faster than that of MindManager because of one-click "fold / unfold" and "follow link" operations.

  • Freemind.for.joomla.logo 

    Freemind for Joomla is a content plugin that easily display mindmap in your articles

    Version 1.2.1

    NEW: Logging is working is debug mode (written to /logs/plg_freemind.php)
    NEW:  New applet using java if you don not like flash (the flash applet is way nicer)
    NEW: Tested with Freemind 0.8.1 and 0.9RC7
    NEW: Add documentation in administrator plugin panel with links to wiki, forums, download

    Support: If you require support for this component please visit the Support Forums.

    Documentation: Official documentation available at Cédric Walter Wiki.

    Do you like this extension? Rate it at Joomla Extension Directory (JED)

    Download Visit the version manager HERE

    Always use the latest version subscribe to the download RSS feed-icon-14x14[26]

  • The AIAA (American Institute of Aeronautics and Astronautics) paper [.pdf] plan to use java (For cost reasons)for safety-critical missions.The first fully time-deterministic and open-source library for Java: Javolution is ready to fight!

    Javolution real-time goals are simple: To make your application faster and more time predictable!
    That being accomplished through:

    • High performance and time-deterministic (real-time) util / lang / text / io / xml base classes.
    • Context programming in order to achieve true separation of concerns (logging, performance, etc).
    • A testing framework addressing not only unit tests but also performance and regression tests as well.
    • Straightforward and low-level parallel computing capabilities with ConcurrentContext.
    • Struct and Union base classes for direct interfacing with native applications (e.g. C/C++).
    • World's fastest and first hard real-time XML marshalling/unmarshalling facility.
    • Simple yet flexible configuration management of your application.

     Top 10 Reason to make a try:

    1. Javolution classes are simple to use, even simpler than most JDK classes. You don't need to guess the capacity of a TextBuilder, FastTable or a FastMap, their size expand gently without ever incurring expensive resize/copy or rehash operations (unlike StringBuilder, ArrayList or HashMap).
    2. Developers may achieve true separation of concerns (e.g. logging, configuration) through Context Programming or by using classes such as Configurable.
    3. Javolution classes are fast, very fast (e.g. Text insertion/deletion in O[Log(n)] instead of O[n] for standard StringBuffer/StringBuilder).
    4. All Javolution classes are hard real-time compliant and have highly deterministic behavior (in the microsecond range). Furthermore (unlike the standard library), Javolution is RTSJ safe (no memory clash or memory leak when used with Java Real-Time extension).
    5. Javolution makes it easy for concurrent algorithms to take advantage of multi-processors systems.
    6. Javolution's real-time collection classes (map, list, table and set) can be used in place of most standard collection classes and provide numerous additional capabilities.
    7. Any Java class can be serialized/deserialized in XML format in any form you may want, also no need to implement Serializable or for the platform to support serialization
    8. Javolution provides Struct and Union classes for direct interoperability with C/C++ applications.
    9. Javolution runs on any platform from the simplest J2ME CLDC 1.0 with no garbage collector to the latest J2EE 5.0 with parameterized types.
    10. Javolution is a pure Java Solution (no native code), small (less than 300 KBytes jar file) and free; permission to use, copy, modify, and distribute this software is freely granted, provided that copyright notices are preserved (BSD License).
  • eclipse&160;

    A very little trick that allow you to quickly run any operation involving a DOS command on an Eclipse project. Go to the external launcher, and create a new configuration.

    This trick may be useful for running your Maven set of command without any dependencies to M2Eclipse.

    &160;

    &160;

    Location:&160; {ENV_VAR:COMSPEC}
    Working Directory: {project_loc}

    eclipse.open.command.line

    {ENV_VAR}

    Returns the value of an environment variable. An environment variable name must be specified as an argument.

    command.line.prompt

  • apache_maven

    We had serious performance problems with MAVEN in our environment. It seems to be a recurrent problem
    for MAVEN... anyway I did came through the following changes...the 2.0.9.db1 Maven2 patch make really
    Maven fly!

    General settings to speed up Maven:

    • More memory for Maven process, change the launcher of eclipse to set MAVEN_OPTS like this:
      -DMAVEN_OPTS="-Xms64m –Xmx128m"
    • Use the latest version of Maven, but be careful of regressions! the latest as for today is 2.0.9
    • There is a patch available for Maven 2.0.9, which speed up build by 40%. It is just simply day and
      night! try it, you'll love it! Basically Don Brown alter MAVEN2 2.0.9 to

    General settings to speed up Eclipse:

    1. Use javaw.exe to start eclipse and not java.exe (more for console base program with a lot of feedback),
      while javaw.exe is more for graphical environment.
    2. Aggressive JIT and double core processors should use:  
       -XX:-UseParallelGC -XX:+AggressiveOpts -XX:-UseConcMarkSweepGC -XX:+UseFastAccessorMethods
    3. Give more memory, MORE MEMORY for eclipse, on a 4GB machine, these are my settings: 
      -Xms768m -Xmx1024m -XX:MaxPermSize=256m
    4. Reduce the number of warning reported by eclipse per compilation unit (class), default is 100, reduce it to 10.
      It help nobody to see a workspace slowing down because of too many warning logging.
      Remove the warnings instead ;-)
    5. SVN console with subversive is too verbose as default, go to eclipse preferences - Team – SVN - Console.
      Logging SVN errors should be enough.
    6. Use a Defragmenter! NTFS fragment fast with so many small files in workspace, every 2 week is a good practice.
    7. I am using Java 1.6u10 (BETA!) and have experience no crash till now,
      being on the edge can be costly in time through. Maven forking should benefit from the reduce java kernel
      size and bootstrap time
  • When working with many feature/release/bugix/hotfix branches, it is a bad idea to start changing the pom version as this will create merge conflicts using pull request. this plugin allow you to keep in ALL branches the same pom version for all your projects, for example MASTER-SNAPSHOT the version will be derived from branch name automagically :-)

    You may want to read more first these 2 short articles

    git-branch-renamer-maven-plugin allow you to keep in ALL branches the same pom version for all your projects: for example MASTER-SNAPSHOT and never change it again.

    the project version will be derived from branch name automatically when running in your continuous integration server.

    branch name feature/xxxx

    • <version>xxxx-SNAPSHOT</version> (default)
    • <version>xxxx</version> (release = true)
    • <version>0-xxxx-SNAPSHOT</version> (forceNumericalVersion = true)
    • <version>feature-xxxx-SNAPSHOT</version> (filterOutBranchQualifier = false)

    The project is hosted at Github https://github.com/cedricwalter/git-branch-renamer-maven-plugin 

    • "RSSOwl collect data from RSS-compliant sites are called RSS readers or "aggregators." RSSOwl is such an application. It lets you gather, organize, update, and store information from any compliant source in a convenient, easy to use interface, save selected information in various formats for offline viewing and sharing, and much more.RSSOwl is also free of charge, fast, cross-platform, and unobtrusive. It's easy to install, easy to use, and easy to move."
      Get RSSOwl
    • Azureus is a java bittorrent client.It provides a bittorrent protocol implementation using java language.Azureus offers multiple torrent downloads, queuing/priority systems (on torrents and files), start/stop seeding options and instant access to numerous pieces of information about your torrents.
    • ComicViewer is a browser for online comics. Using a simple interface you can read multiple comics without having to browse all the sites.
  • The Apache  software fundation has put a new project in it's incubator line: Harmony

    A free open source Java virtual machine and classes librairies!!!

    Right now it is only a thread, and a FAQ...an interesting discussion has start on Slashdot.org  

    Purpose of this project is to create and use an open source, compatible implementation of J2SE
    5, the latest version of the Java 2 Standard Edition specification.

    "The Apache Software Foundation provides support for the Apache community of open-source software projects. The Apache projects are characterized by a collaborative, consensus based development process, an open and pragmatic software license, and a desire to create high quality software that leads the way in its field. We consider ourselves not simply a group of projects sharing a server, but rather a community of developers and users."

    Update: Sun executives have endorsed the project, and the company might even participate. found at www.informationweek.com

  • Â Read this document about classloader (PDF)
    • System classloader is the content of the system variable CLASSPATH= you defined higher level
    • Loader of the servlet runner is own classloader of Resin, tomcat or other
    • Application classloader (controlled by resin or tomcat) find classes which are in the webapps directory (Application class).
    • Your own classloader if you write own lower level

    As soon as you request a class in one of these loader, the classloader will take the first found during its walk under this rules:

    • if the class is not found at the current level (place where you request it, most of the time in your application), it will try to load it from the upper level, if not found it will continue and finish in the system classloader.
    • There is no downward request.
  • I will try to keep an history of all my previous machine on this page...yes it is just a nerd/geek behavior...

    geek-inside

    In 15 years...

    • Cost in euro are in green, are similar in amount, you just get more size, disk, speed for your buck
    • 1208 times more IPS and my PC is still sometimes hanging (In order Vista, XP, Linux I look at you) :-(
    • 81 times more disk space!
    • Power consumption 360 watts today :-(
    • PC are still slower than what I expect...

     

    Instructions per second (IPS) is a measure of a computer's processor speed. Many reported IPS
    values have represented "peak" execution rates on artificial instruction sequences with few branches,
    whereas realistic workloads consist of a mix of instructions and even applications, some of which take
    longer to execute than others. The performance of the memory hierarchy also greatly affects processor
    performance, an issue barely considered in MIPS calculations. Because of these problems, researchers
    created standardized tests such as SPECint to (maybe) measure the real effective performance in
    commonly used applications, and raw IPS has fallen into disuse. [WikiPedia]

  • hosts.file The hosts file is a computer file used by an operating system to map hostnames to IP addresses. This method is one of several methods used by an operating system to locate network nodes on a computer network. Spybot Search and Destroy is using this technique when you click on immunize button behind the scene.

    Found at http://someonewhocares.org/hosts/

    Use this file to prevent your computer from connecting to selected internet hosts. This is an easy and effective way to

    • protect you from many types of spyware,
    • reduces bandwidth use,
    • blocks certain pop-up traps,
    • prevents user tracking by way of "web bugs" embedded in spam,
    • provides partial protection to IE from certain web-based exploits
    • blocks most advertising you would otherwise be subjected to on the internet.

    There is a version of this file that uses 0.0.0.0 instead of 127.0.0.1 available at http://someonewhocares.org/hosts/zero/. On some machines this may run minutely faster, however the zero version may not be compatible with all systems.

    This file must be saved as a text file with no extension. (This means it that the file name should be exactly as below, without a ".txt" appended.). Let me repeat, the file should be named "hosts" NOT "hosts.txt".

    For Windows 9x and ME

    place this file at "C:\Windows\hosts"

    For NT, Win2K and XP

    use "C:\windows\system32\drivers\etc\hosts" or "C:\winnt\system32\drivers\etc\hosts"

    For Linux, Unix, or OS X place this file at "/etc/hosts". You will require root access to do this. Saving this file to "~/hosts" will allow you to run something like "sudo cp ~/hosts /etc/hosts".

    Ubuntu

    Users who experience trouble with apt-get should consult http://ubuntuforums.org/archive/index.php/t-613521.html

    OS/2

    Copy the file to "%ETC%\HOSTS" and in the CONFIG.SYS file, ensure that the line "SET USE_HOSTS_FIRST=1" is included.

    BeOS / Zeta / Haiku

    Place it at "/boot/beos/etc/hosts"

    Netware system

    The location is System\etc\hosts"

    For Macintosh (pre OS X)

    Place it in the Mac System Folder or Preferences folder and reboot. (something like HD:System Folder:Preferences:Hosts)

    Alternatively you can save it elsewhere on your machine, then go to the TCP/IP control panel and click on "Select hosts file" to read it in.As well, note that the format is different on old macs, soplease visit http://someonewhocares.org/hosts/mac/ for mac format

    If there is a domain name you would rather never see, simply add a line that reads "127.0.0.1 machine.domain.tld". This will have the effect of redirecting any requests to that host to your own computer. For example this will prevent your browser from downloading banner ads, or sendingyour information back to a company.

  • gmail-logo&160; hotmail_logo

    A small trick that will let you consult your hotmail message from GMAIL and as such will be a lot more easier to consult on the iPhone.

    Gmail's Mail Fetcher can download messages from up to five other email accounts, centralizing all your email in Gmail. The tabs above have information on setting up Mail Fetcher, as well as troubleshooting tips for the common problems users face.

    Note: You don’t need any premium hotmail account, even a free account at hotmail will work! One more time, thanks Google!

    Log into GMAIL,go to settings, under “Get mail from other accounts”

    add.hotmail.to.gmail.for.iphone.00

    Enter the email address of the account to get mail from

    add.hotmail.to.gmail.for.iphone&160;&160;

    Enter the mail settings for your mailbox, customize

    add.hotmail.to.gmail.for.iphone.01

    We are nearly finished

    add.hotmail.to.gmail.for.iphone.02

  • i.will.use.google.before.asking.dumb.questions

    Went through this interesting article “How To Ask Questions The Smart Way”, while a bit old (2006), it is full of very good advices for asking questions the smart way (and also sometimes finding an answer on your own).

    In the world ofhackers, the kind of answers you get to your technical questions depends as much on the way you ask the questions as on the difficulty of developing the answer. This guide will teach you how to ask questions in a way more likely to get you a satisfactory answer.
    Now that use of open source has become widespread, you can often get as good answers from other, more experienced users as from hackers. This is a Good Thing; users tend to be just a little bit more tolerant of the kind of failures newbie's often have. Still, treating experienced users like hackers in the ways we recommend here will generally be the most effective way to get useful answers out of them, too.
    The first thing to understand is that hackers actually like hard problems and good, thought-provoking questions about them. If we didn't, we wouldn't be here. If you give us an interesting question to chew on we'll be grateful to you; good questions are a stimulus and a gift. Good questions help us develop our understanding, and often reveal problems we might not have noticed or thought about otherwise. Among hackers, “Good question!” is a strong and sincere compliment.

  • subversion.logo

    If you are using Subversion/CVS, you might have come across the issue where multiple developers working on a set of files are committing without any comments.

    Subversion’s hook scripts provide a powerful way to associate actions with repository events. For example, the pre-commit hook allows you to check — and possibly abort — a transaction before it actually gets committed. I will provide you now two easy Unix bash scripts  that avoid bad developer behaviors:

    • The first one “checkCommentNotEmpty.sh” is for checking that nobody submit an empty SVN commit comment
    • The second one “checkCommentSyntax.sh” is able to enforce SVN commit comment pattern using regular expressions

    Creating and Installing a Hook Script

    Your Subversion repository already has some template hook scripts. For example, the pre-commit template is in PATH_TO_REPOS/hooks/pre-commit.tmpl. These templates contain instructions on what the hook script does and what parameters it can expect.

    You can hook your own script on the following events

    • start-commit Before the commit transaction starts
    • pre-commit After the commit transaction starts but before the transaction is committed
    • post-commit After the commit transaction completes
    • pre-revprop-change Before a revision property is changed Repository Path,
    • post-revprop-change: After a revision property is changed Repository Path
    • pre-lock: Before the lock being acquired
    • post-lock: After the lock being acquired

    You’ll find examples in the hook directory named

    • post-commit.tmpl
    • pre-unlock.tmpl
    • post-lock.tmpl
    • pre-commit.tmpl
    • start-commit.tmpl
    • post-revprop-change.tmpl
    • pre-lock.tmpl
    • post-unlock.tmpl
    • pre-revprop-change.tmpl

    If you cant find them, brute force your server to locate them

    # find / –name pre-commit

    or

    # locate pre-commit

    On Debian you will find them at

    /data/svn-repos/{yourRepository}/hooks

    Create a file pre-commit with that content, nothing force you to put a huge bash script in pre-commit. In my example below, I prefer to divide pre-commit checks in multiple files. The pre-commit hook gives you a way to catch the transaction before it becomes a revision. Subversion passes this hook two parameters:

    1. the path to the root of the repository
    2. the transaction identifier
    #!/bin/sh
    set -e
    /data/svn-repos/{yourRepository}/hooks/checkCommentNotEmpty.sh "$1" "$2"
    /data/svn-repos/{yourRepository}/hooks/checkCommentSyntax.sh "$1" "$2"

    Note that after installation, every commit will run these two scripts. Check your permissions, scripts have to be runnable for the user (www-data on debian)

    Avoid empty comment in SVN commits

    Save this file in /data/svn-repos/{yourRepository}/hooks/checkCommentNotEmpty.sh

    #!/bin/sh
    REPOS="$1"
    TXN="$2"
    SVNLOOK=/usr/bin/svnlook
    
    if [`$SVNLOOK log -t $TXN $REPOS` != ""]; then
      echo "" 1>&2
      echo "*** Your commit has been blocked because you did not give any log message or your log message was too short." 1>&2
      echo "Please write a log message describing the purpose of your changes and then try committing again." 1>&2
      exit 1
    else
      exit 0
    fi

    Example in Eclipse, if you break the rule

    noEmptySVNCommitComment

    Enforce SVN commit comment pattern using regular expressions

    Save this file in /data/svn-repos/{yourRepository}/hooks/checkCommentSyntax.sh

    This script use Bash script REGEX capabilities, I check against what could be a typical JIRA issues entry

    If any developer try to use a commit statement not starting with for example PRODUCT-xxxx, the commit will be blocked.

    #!/bin/sh
    REPOS="$1"
    TXN="$2"
    SVNLOOK=/usr/bin/svnlook
    regex="PRODUCT-[0-9]*"
    
    if [[ `$SVNLOOK log -t $TXN $REPOS` =~ ${regex} ]]; then
      exit 0
    else
      echo "" 1>&2
      echo "*** Your commit has been blocked because you give an invalid commit comment" 1>&2
      echo "Please make your commit comment start with PRODUCT-XXX" 1>&2
     exit 1
    fi

    Example in Eclipse, if you break the rule

    checkSVNCommitCommentWithRegularExpressions

    Want more?

    You can automated code reviews with Checkstyle using pre-commit script and so Stop rule-breaking code before it enters your code base!

    References

    hook_scripts" target="_blank">http://subversion.tigris.org/tools_contrib.htmlhook_scripts List of some Hook scripts examples written in python/bash

  • Controlling a RC Helicopter