Visual 3 Way Merge Tool

Perforce – Visual Merge Tool
For visual three way merging of source code
my tool of choice is the “Visual Merge Tool” by Perforce.
Go to http://www.perforce.com/downloads
Browse by Component | Clients | Visual Merge Tool
Download and install the appropriate installer.
During installation deselect not needed software components.

Winmerge
As an alternative you might use Winmerge.
It’s about 3MB in size and offers a solid GUI for two way merging.
Go to http://winmerge.org/downloads/?lang=de

Tell Git about it
To automatically open your favorite merge tool during GIT operations
you need to modify your ~/.gitconfig and add the following:

[merge]
    tool = p4tool
[mergetool "p4tool"]
    cmd = \"/c/Program Files/Perforce/p4merge.exe\" \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"
    keepBackup = false
[mergetool]
    prompt = false

The “cmd” directive contains the call to the merge tool, which is basically the same call you would use on the shell.
So if you are going to choose Winmerge you need to alter it accordingly.

ZNC Installation Script for Debian

#!/bin/bash
#
# ZNC Installation Script for Debian
# ----------------------------------
# Author: Jens-Andre Koch
# Date: 14.03.2012
# --------------------------------<3

# fetch znc-version.tar.gz archive from github
wget --no-check-certificate https://github.com/znc/znc/tarball/znc-0.204 -O - | tar xz

# fetch latest version from ZNC HQ
#wget http://znc.in/nightly/znc-latest.tar.gz -O - | tar xz

# for building znc from source, the following packages are needed:
#apt-get install build-essential libssl-dev libperl-dev swig python3 python3-dev tcl8.5 tcl8.5-dev

cd znc-*

# produce the "configure" script
./autogen.sh

# Installation
#
# Example
# --enable-tcl --with-tcl=/path
# --enable-openssl --with-openssl=/path
# --enable-debug
#
# If you want to run ZNC WITHOUT installing it
# (directly from source) then use:
# --enable-run-from-source
#
./configure --enable-tcl -enable-python
make
make install

# add new user
adduser zncbouncer

# use user "zncbouncer" to create a configuration for ZNC (-c, --makeconf)
sudo -u zncbouncer znc -c

/usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.a: could not read symbols: Bad value

Means your G++ installation is bad. Somehow the “libstdc++.so.version” file gone mia, possibly due to mixed updates to the system.

Solutions include downgrading via
“apt-get install libstdc++6=4.4.5-8″
or upgrading via
“apt-get install -t wheezy g++ libstdc++”.

Check “ls /usr/lib/libstdc*” exists and symlinks are correct, then recompile.

PHP – importSQL() und getQueriesFromSQLFile()

Die nachfolgenden Funktionen habe ich im Installationsprogramm einer Webanwendung eingesetzt. Sie sind nützlich, um SQL aus einem Databasedump mittels PHP einzuspielen, wenn man direkt mit PDO arbeitet. Durch die Umstellung des Installationsprogramms auf Doctrine2 werden beide nicht mehr benötigt. Daher archiviere ich beides hier und gebe es zum Reuse unter der GPLv2+ frei.

/**
 * Loads an SQL stream into the database one command at a time.
 *
 * @params $sqlfile The file containing the mysql-dump data.
 * @params $connection Instance of a PDO Connection Object.
 * @return boolean Returns true, if SQL was imported successfully.
 * @throws Exception
 */
function importSQL($sqlfile, $connection)
{
    $queries = getQueriesFromSQLFile($sqlfile);

    foreach($queries as $query)
    {
        try
        {
            $connection->exec($query);
        }
        catch (Exception $e)
        {
            echo $e->getMessage() . "<br /> <p>The sql is: $query</p>";
        }
    }

    return true;
}

/**
 * getQueriesFromSQLFile parses a sql file and extracts all queries
 * for further processing with pdo execute.
 *
 * - strips off all comments, sql notes, empty lines from an sql file
 * - trims white-spaces
 * - filters the sql-string for sql-keywords
 * - replaces the db_prefix
 *
 * @param $file sqlfile
 * @return array Trimmed array of sql queries, ready for insertion into db.
 */
function getQueriesFromSQLFile($sqlfile)
{
    if(is_readable($sqlfile) === false)
    {
        throw new Exception($sqlfile . 'does not exist or is not readable.');
    }

    # read file into array
    $file = file($sqlfile);

    # import file line by line
    # and filter (remove) those lines, beginning with an sql comment token
    $file = array_filter($file,
                    create_function('$line',
                            'return strpos(ltrim($line), "--") !== 0;'));

    # and filter (remove) those lines, beginning with an sql notes token
    $file = array_filter($file,
                    create_function('$line',
                            'return strpos(ltrim($line), "/*") !== 0;'));

    # this is a whitelist of SQL commands, which are allowed to follow a semicolon
    $keywords = array(
        'ALTER', 'CREATE', 'DELETE', 'DROP', 'INSERT',
        'REPLACE', 'SELECT', 'SET', 'TRUNCATE', 'UPDATE', 'USE'
    );

    # create the regular expression for matching the whitelisted keywords
    $regexp = sprintf('/\s*;\s*(?=(%s)\b)/s', implode('|', $keywords));

    # split there
    $splitter = preg_split($regexp, implode("\r\n", $file));

    # remove trailing semicolon or whitespaces
    $splitter = array_map(create_function('$line',
                            'return preg_replace("/[\s;]*$/", "", $line);'),
                          $splitter);

    # replace the default database prefix "your_prefix_"
    $table_prefix = $_POST['config']['database']['prefix'];
    $splitter = preg_replace("/`your_prefix_/", "`$table_prefix", $splitter);

    # remove empty lines
    return array_filter($splitter, create_function('$line', 'return !empty($line);'));
}

Werkzeug um Abhängigkeiten eines Programms zu ermitteln

DependencyWalker ist ein Werkzeug von Steve P. Miller zur hierarchischen Auflistung aller Abhängigkeiten eines Programms. Es können .exe, .dll, .ocx und .sys Dateien unter w32 und w64 untersucht werden. Das Tool läuft Standalone. Es ist aber auch als Bestandteil zahlreicher Microsoft Produkte, so u.a. Visual Studio, Visual C++, Visual Basic zu finden. Die aktuellste Version lässt sich unter http://www.dependencywalker.com abrufen.

Download (x86)

Next Page →