Blog

setup a new WordPress site in five minutes

  1. Choose a name, e.g. my-new-blog.com
  2. Order and setup the new domain according to your provider
  3. Create a “wordpress” user (see here).
  4. Setup a database and phpMyAdmin to administrate it (see here).
  5. Download latest WordPress
  6. A new folder wordpress is created
  7. Rename wordpress to e.g. mynewblog
  8. Create a symlink to the wordpress directory
  9. Configure Apache2
    1. Create a site configuration: Make it look like this:
    2. Enable the site
    3. Change permissions for the new website directory to www-data (the webserver user)
  10. Done! Open my-new-blog.com to access your fresh WordPress site.

‘undo’ ssh-add

  • List all available keys.
  • Remove a key.
  • List all available keys.

MySQL won’t start automatically during system startup

  • P: The MySQL service does not automatically start during system startup.

  • A:
    1. Purge and redo startup scripts:
    2. Change bind-address to 0.0.0.0: Find bind-address = 127.0.0.1 and change it to bind-address = 0.0.0.0
    3. Check /etc/init/mysql.override: This file might override your startup settings. In case it looks like this
      $ less /etc/init/mysql.override
      manual
      
      Execute the following:
    4. Done.

sort a Set

Q: How to sort an instance of java.util.Set?

A:

See a more detailed explanation here.

run a backtest using the JForex API (v. 2.x)

  1. Create a client instance
  2. Register event listeners
  3. Connect the client
  4. Configure the time period to backtest
  5. Configure the instrument
  6. Start the Backtest
Get more info here: Dukaskopy Knowledge Base

maintain library project for Maven and Eclipse RCP/ OSGi in the same repository

If you are working both in the Maven and the Eclipse RCP/ OSGi universe, you might find it quite frustrating that these two worlds cooperate so poorly. In order to use the same library in both worlds, a lot of error-prone copy-and-paste is needed, at least if you would like to use this project in a Maven and Maven Tycho build.

In principle, there is not much that is different for a Maven artifact and an Eclipse RCP/ OSGi Plug-in:
In an Eclipse RCP/ OSGi Plug-in you just need an additional META-INF/MANIFEST.MF and build.properties file. The problem comes with the Maven pom file, which looks completely different for standard Maven and Maven Tycho. Luckily, you can specify the name of the pom file when invoking Maven:

Therefore, you can just maintain two pom files and with only few limitations, it is possible to maintain a library that can be used in a standard Maven build and in a Maven Tycho build within the same repository:

  1. Modify your .gitignore so that it contains the following lines:
    bin
    .project
    .settings
    .classpath
    
    We don’t want to have any Eclipse project configuration information in the project, since we want to be able to import it both as ‘Maven project’ and ‘Eclipse/ OSGi project’.
  2. Remove all files from the git index that match the pattern above.
    • If your project is a Maven project, right-click on the project and select ‘Configure -> Convert to Plug-in project’. This will create the META-INF/MANIFEST.MF and build.properties files.
    • If your project is a Plug-in project, right-click on the project and select ‘Configure -> Convert to Maven project’. This will create the pom.xml file.
    These steps are optional and only needed if you are missing either pom.xml or META-INF/MANIFEST.MF and build.properties .
  3. Create the Tycho pom file, name it e.g. pom-tycho.xml. It’s content should look like this:
  4. Commit all changes and delete the project from your workspace.
  5. Import the project using the ‘Import Existing Maven Project’ or ‘Checkout Maven Project from scm’ wizard. To use the project as an Eclipse RCP/ OSGi Plug-in project, disable it’s Maven nature via ‘Maven -> disable Maven nature’.
  6. Done!
Note: You manually need to keep in sync the version strings in pom.xml, META-INF/MANIFEST.MF and pom-tycho.xml! E.g. after running a Maven release, you need to adapt the version numbers in META-INF/MANIFEST.MF and pom-tycho.xml so that they match the automatically changed version strings in pom.xml.
Also note that you cannot use a Bundle Activator in this project. If you need one, just create another Eclipse-RCP Plug-in that depends on your library and contains a Bundle Activator.

Troubleshooting: After importing as Maven project or converting to Maven project, you might run into build-path problems. Try to resolve using ‘right-click on project -> Maven -> Update Project..’ And/ or fix the Java Build Path of the project (Standard Eclipse source folder is src, in Maven it is src/main/java). java-build-path

change file encoding recursively

Good: Bad: The second one will only work if find will not descend into sub directories, since the directory tree inside of converted will not be created on demand, as it would be the case e.g. for mkdir -p. The result will be a ‘file or directory not found’ error.

mv: do not override destination file that is newer than source file (update move)

mv does not support the update option, unlike rsync and cp. If your version of coreutils does support it, using cp (followed by rm) is the easiest way to perform an update move operation: