Blog Archives

Convert DVDs

A nice tutorial in German is available on http://www.selflinux.org/selflinux/html/dvd-rippen.html.

Access to Ant properties from IzPack XML

Inside the installation XML the access to Ant properties per

@{ant.property.name}

will only work, if you insert the whole XML content as CDATA into the build.xml

<IzPack output="${dist.dir}/IzPack-install.jar"
        installerType="standard"
        basedir="${dist.dir}"
        IzPackDir="${dist.dir}/">
        <config><![CDATA[
<installation version="1.0">
   <info>
      <appname>@{my.app.name.defined.in.build.xml}</appname>
      ...
   </info>
...
        ]]></config>
</IzPack>

If you use different files, the properties are unknown within the IzPack file. But there is a simple solution: Copy the install.xml into a temporary file and expand the properties during this step.

<target name="installer" depends="jar" description="compiles the IzPack installer">
	<copy overwrite="yes" verbose="yes" file="${dir.install}/izpack/install-definition.xml" tofile="${java.io.tmpdir}/install-definition.xml">
		<filterchain>
			<expandproperties />
		</filterchain>
	</copy>
	<IzPack input="${java.io.tmpdir}/install-definition.xml" output="${dir.dest}/${app.name}-install.jar" installerType="standard" basedir="${basedir}" />
</target>

So you can use ${app.name} inside the install.xml (don’t use @{app.name}). But you shouldn’t use Ant properties, which are redefined by IzPack itself or in a <variable> tag section. These properties are expanded before Ant calls IzPack and could contain the wrong values.

Special characters within IzPack XML

If you need some defined XML entities like é within the IzPack installation XML, you can’t use it there. The reason: they aren’t defined. But you can define a subset within your XML:

  <?xml version="1.0" encoding="iso-8859-1" ?>
  <!DOCTYPE installation [
  <!ENTITY % iso-lat1 PUBLIC "ISO 8879:1986//ENTITIES Added Latin 1//EN//XML"
                    "http://www.oasis-open.org/docbook/xmlcharent/0.3/iso-lat1.ent">
  %iso-lat1;
  ]>
  <installation version="1.0">
    <!-- start here -->
  </installation>

These additional lines include the usual entities. It is now possible to use:

  <authors>
    <author name="Andr&eacute; Rothe" email="andre.rothe@domain.local" />
  </authors>

Safe copy of directories

Use


rsync -avx --progress /source/ /dest

to copy the complete content of /source into /dest, the source folder itself wont be copied (trailing /). Remove the slash and you will copy the /source folder and its content into /dest.

Use


rsync -avx --progress /source/ user@remote-host:port/dest

for syncronization between workstations.

Code Formatter Eclipse

Today I had the problem, that I had installed a new Eclipse on my workstation, but I forgot the code style configuration at home. I tried to connect per SSH, but I have no X server on the machine at home. So I cannot run Eclipse to export the configuration as XML. But there is a simple solution for that, copy the information from the right configuration file.

You can find the formatter profiles in the file

/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs

There is a very long line starting with org.eclipse.jdt.ui.formatterprofiles, which you can copy to your local installation. Close your Eclipse and restart it after the change and you will find the new formatter in the drop-down-list within the preferences.

The better way would be to export the formatter definitions as XML within Eclipse and check-in the file into your Subversion/Git.

A two way sync between Git and SVN

  • Create a GIT repository on GitHub.com.
  • Create a local repository from the GitHub repository

Use your SSH-Key (uploaded to GitHub.com)!

$ git clone git@github.com:witchi/PHP-SQL-Parser.git

  • switch to the new repository directory
  • Create a SVN tracking branch, which contains all the SVN changes


$ cd PHP-SQL-Parser
$ git branch --no-track svnsync
$ git checkout svnsync
$ git svn init -s https://php-sql-parser.googlecode.com/svn

  • write a file which contains all SVN authors and store it as svn-authors.txt into the Git repository directory
  • fetch all revisions from SVN
  • set the HEAD of the svnsync GIT branch to the latest SVN revision


phosco@gmx.de = André Rothe <phosco@gmx.de>
greenlion = Justin Swanhart <greenlion@gmail.com>
greenlion@gmail.com = Justin Swanhart <greenlion@gmail.com>
Justin Swanhart = Justin Swanhart <greenlion@gmail.com>
(no author) = Justin Swanhart <greenlion@gmail.com>


$ git svn fetch -A svn-authors.txt
$ git reset --hard remotes/trunk

Merge changes from SVN into Git

  • go to the svnsync branch
  • get all the new revisions from the SVN repository
  • go to the master branch (Git)
  • merge all changes from svnsync into the master
  • use meld to solve merge conflicts
  • upload all changes to the GitHub repository


$ git checkout svnsync
$ git svn rebase -A svn-authors.txt
$ git checkout master
$ git merge svnsync
$ git mergetool
$ git push origin master

Merge changes from Git into SVN

  • go to the master branch of Git
  • get all changes from the Github repository
  • go to the svnsync branch
  • get all new revisions from the SVN
  • merge all Git changes from master into the svnsync branch (without fast-forward, it creates a new commit point)
  • use meld to solve merge conflicts
  • commit the changes into svnsync branch (local)
  • commit the changes to the SVN repository server (remote)


$ git checkout master
$ git pull origin master
$ git checkout svnsync
$ git svn rebase -A svn-authors.txt
$ git merge --no-ff master
$ git mergetool
$ git commit
$ git svn dcommit

First steps with Git

To set some important configuration properties for Git use the following commands:


$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
$ git config --global merge.tool meld

The properties are set for all repositories on the current machine.

Fail2Ban

A tutorial (in German):
http://blog.256bit.org/archives/383-fail2ban-und-der-Kampf-gegen-Trackback-Spam.html

http://www.fail2ban.org/wiki/index.php/HOWTOs
http://www.fail2ban.org/wiki/index.php/MANUAL_0_8

PHP_CodeSniffer standards

Look into /usr/share/php5/PEAR/PHP/CodeSniffer/Standards

All sub-folders there can be used as standard name:


phpcs --standard=PEAR test.php
phpcs --standard=Zend test.php

Use keywords with SVN

You can use keyword replacement with Subversion. A good tutorial is available on http://www.startupcto.com.