Java – Call a shell script and wait until it’s end


Send Strg + C on Eclipse in Linux

I wasn’t able to send strg + c in the console. So I found the following command which must be executed from a shell.


Install Laravel 4.2 on Ubuntu Server 14.04 LTS

I was having a little trouble getting Laravel installed on a newly installed Ubuntu 14.04 LTS server. I’ve decided to document the whole process in hopes that I’ll use the documentation to good use once again sometime in the future. Who knows, someone will benefit from reading this. I’m not the only one that will be doing a Laravel installation on Ubuntu.

If you need to install Ubuntu from scratch, I recommend that use install LAMP and SSH because you’ll need those services to support Laravel. PHP, MySQL, Apache and SSH would be installed for you right out of the gate. In addition, I recommend that you install PHPMyAdmin for database administration.

In Ubuntu, the default document root is /var/www/. Before starting, let’s make sure we got the correct permissions for Apache, and for the user (you). This is to prevent so you don’t run into issues with write permissions on the document root.

Permissions for /var/www/

Let’s get the prerequisites taken care of before installing Laravel

Install Curl

Install Mycrypt

Activate Mcrypt

Enable Mod-Rewrite

Install Laravel via Composer

Install Composer First

Installer Composer Globally

Install Laravel

Set up your Apache virtual host

The cool thing about this example is, by setting up your /var/www permissions, you don’t need to change permissions to “app/storage” since you already have the correct permission to /var/www.

Finally, access Laravel from the IP address of your Ubuntu Server. The IP address of your Ubuntu server should be a static IP address. You can set this in the network config file called /etc/networking/interfaces.

Have fun!

MySQL Datenbank Backup mit PHP

Script um ein Backup einer MySQL Datenbank mittels PHP durchzufuehren.

Die Datei kann mittels eines CRON-Jobs aufgerufen werden.


Python, Subprocess and Multiple Arguments


Calling external programs from within a python script is a pretty common task. However, most of the times when I want to pass some arguments to the external program, I usually get stuck. The official Python documentation for the subprocess module is a bit lacking, in my humble opinion, in its treatment of argument passing.

This is not to say that all the information isn’t available in the official documentation. In fact, it is. It’s just not where I always look for it. The first thing I look for are examples. I simply do not have time to read the entire documentation page for something which should not be too difficult.

The basic idea is this:

  1. Either provide a string of the entire command and argument, but use Shell=True
  2. Provide a string for only the command
  3. Provide a list of strings, where the first item is the command and the other items are the arguments

It’s the third option that keeps on giving me trouble, so here is a simple working example for reference:

Passing Arguments with Quotes
If you want to pass arguments that are passed with quotes in the shell, then just pass them as a single list item, without the quotes.

Choosing The SSL Version In Python Requests


Over the last few months (and probably for quite a while before then too), a few issues have been raised on the Requests GitHub page asking how to select the version of SSL used by Requests. This is actually simple once you know how, so I thought I’d write a short post to show you how it’s done.

A quick note before we begin: it is not possible to select the version of SSL you want to use before Requests v1.0.0 without changing the underlying library code. The following set of instructions will not work if you’re running an earlier version.

How It’s Done

Altogether this is relatively simple. To change the SSL version used in HTTPS, you are expected to subclass the HTTPAdapter class and mount it to a Session object. If, for example, you wanted to force the use of TLSv1, your new Transport Adapter will look like this:

With that done, you can mount it to a Requests Session object:

Of course, this is so easy that it’s simple to write a Transport Adapter that can take an arbitrary SSL type from the ssl package in the constructor and use that. Whack this in a file and import it into whatever you’re doing:

You can mount it to a Session object and just go to town.

Hopefully this will be of use to people. If you have any problems or improvements, leave a note in the comments or drop me a line on Twitter (the url is in the sidebar).

Apache PHP Error-Meldungen anzeigen lassen

Damit auftretende Fehlermeldungen von PHP auf der Website angezeigt werden, muss die Datei /etc/php5/apache2/php.ini angepasst werden.

In der Zeile 539 befindet sich der Ausdruck display_errors = Off

Off in On umändern und Apach2 neustarten.

Jetzt werden Fehler angezeigt.


Creating Java Classes from WSDL file using Apache Axis 2

Since I didn’t found this on the internet (but some rather outdated or complicated tutorials) here’s how to create Java class as wrapper for a given SOAP webservice.

  1. Download most recent Apache Axis 2: I used version 1.5.1
  2. Extract it to a directory of your choice
  3. On the command line, change to subdirectory bin/ and run wsdl2java.bat -uri [URL of WSDL file] (on Windows) or -uri [URL of WSDL file] on Linux.
  4. The Java classes are created in the src/ subdirectory. Copy them into your project

To effectivly use the classes generated you must add a bunch of jars to your project dependiencies. These are found in the lib/ directory of the extracted Apache Axis distribution. You need ([version] notes a version number):

  • axis2-adb-[version].jar
  • axis2-kernel-[version].jar
  • axis2-transport-local-[version].jar
  • axis2-transport-http-[version].jar
  • axiom-api-[version].jar
  • axiom-dom-[version].jar
  • axiom-impl-[version].jar
  • commons-codec-[version].jar
  • commons-logging-[version].jar
  • commons-httpclient-[version].jar
  • httpcore-[version].jar
  • mail-[version].jar
  • neethi-[version].jar
  • wsdl4j-[version].jar
  • XmlSchema-[version].jar

Apache Axis generated a class class [Name of Webservice]Stub, e.g. for a webservice TimeOfDay it would be TimeOfDayStub. This class has all the webservice’s methods and nested classes for the method’s arguments. Everything is relatively straight forward and easy to use.

That’s it.

There is an Apache Axis Eclipse plugin for converting WSDL into Java classes, but the download URL seems broken. I also tried to use Eclipse’s WSD toolset, but this unnecessarily requires a local web server to be set up and running.


Rechte von Ordner unter Windows 7 auslesen

Dieses Skript wurde von am 14.12.2012 erstellt.

Schwierig gestaltete sich, dass Das get-acl cmdlet bei gemischten Rechten oft Zahlen wie 2032127 zurückgibt. Die Herausforderung war es, diese in eine lesbare Form zu mappen.

  1. Die im Path File gespeicherten Pfade zu den Ordnern auslesen.
  2. Jeden Ordner prüfen, ob er existiert
  3. Wenn er existiert -> Alle User und Gruppen mit Berechtigungen auslesen

Wenn es Gruppen sind müssen aus dem AD noch alle User aus der Gruppe abgefragt werden.

4. Das Ergebnis für Schreibrechte und Leserechte getrennt in eine Datei exportieren oder ausgeben

Datei herunterladen: Ordnerrechte



Update Trigger

Mit diesem Trigger wird ein Wert in eine History Tabelle geschrieben, wenn es eine Änderung in der ursprünglichen Tabelle gegeben hat.

Veröffentlicht unter DML | Verschlagwortet mit