MySQL UTF-8 fix Umlaute

Geht ziemlich schnell Sonderzeichen zu reparieren in MySQL! Scheiß Encoding! ;)

UPDATE `table` set
    `column`= REPLACE(`column`,"ß", "ß"),
    `column`= REPLACE(`column`, "ä", "ä"),
    `column`= REPLACE(`column`, "ü", "ü"),
    `column`= REPLACE(`column`, "ö", "ö"),
    `column`= REPLACE(`column`, 'Ä', 'Ä'),
    `column`= REPLACE(`column`, "Ãœ", "Ü"),
    `column`= REPLACE(`column`, "Ö", "Ö"),
    `column`= REPLACE(`column`, '€', '€');

jquery input title hint

jQuery.fn.inputHints=function() {
    // hides the input display text stored in the title on focus
    // and sets it on blur if the user hasn't changed it.

    // show the display text
    jQuery(this).each(function(i) {
        jQuery(this).val(jQuery(this).attr('title')).addClass('hint');
    });

    // hook up the blur & focus
    return jQuery(this).focus(function() {
        if (jQuery(this).val() == jQuery(this).attr('title')){
            jQuery(this).val('').removeClass('hint');
        }
    }).blur(function() {
        if (jQuery(this).val() === ''){
            jQuery(this).val(jQuery(this).attr('title')).addClass('hint');
        }
    });
};

jQuery(document).ready(function() {
    jQuery('input[title]').inputHints();
});

PHP detect IOS / iPhone / iPad / iPod

Very simple

<?php
function is_ios(){
    if (stripos($_SERVER['HTTP_USER_AGENT'],"iPhone")  !== false) {
        return true;
    } elseif (stripos($_SERVER['HTTP_USER_AGENT'],"iPad") !== false) {
        return true;
    } elseif (stripos($_SERVER['HTTP_USER_AGENT'],"iPod") !== false) {
        return true;
    }
    return false;
}
?>

Windows 8 Ruhezustand / Suspend to disk / Hybernate

Leider gibt es inWindows 8 keinen Knopf um Windows in den Ruhezustand zu schicken. Sicherlich startet Windows 8 sehr schnell, aber wenn es darum geht den Zustand von Programmen bei zubehalten, reicht das nicht.
Zum Glück kann man sich eine Verknüpfung auf dem Desktop anlegen: C:\Windows\System32\rundll32.exe powrprof.dll,SetSuspendState Und schon klappt der Ruhezustand wieder :-)

Compling Apache 2.4 on Ubuntu or Debian

wget http://httpd.apache.org/dev/dist/httpd-2.4.2.tar.gz
wget http://httpd.apache.org/dev/dist/httpd-2.4.2-deps.tar.gz
tar xvfz httpd-2.4.2.tar.gz
tar xvfz httpd-2.4.2-deps.tar.gz
cd httpd-2.4.2/srclib
wget http://mirror.netcologne.de/apache.org//apr/apr-iconv-1.2.1.tar.gz
tar xvfz apr-iconv-1.2.1.tar.gz
mv apr-iconv-1.2.1 apr-iconv
wget http://zlib.net/zlib-1.2.6.tar.gz
tar xvfz zlib-1.2.7.tar.gz
mv zlib-1.2.7 zlib
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.21.tar.gz
tar xvfz pcre-8.21.tar.gz
mv pcre-8.21 pcre
wget http://www.openssl.org/source/http://openssl.org/source/openssl-1.0.1.tar.gz
tar xfz openssl-1.0.1.tar.gz
cd openssl-*
./config --prefix=/usr zlib-dynamic --openssldir=/etc/ssl shared
make
make test
sudo make install
cd ../..
./buildconf
./configure --prefix=/opt/apache2 --enable-pie --enable-mods-shared=all --enable-so --disable-include --enable-deflate --enable-headers --enable-expires --enable-ssl=shared --enable-mpms-shared=all --with-mpm=event --enable-rewrite --with-z=/home/mario/apache24/httpd-2.4.2/srclib/zlib --enable-module=ssl --enable-fcgid --with-included-apr
make 
sudo make install
cd ..
wget http://www.trieuvan.com/apache//httpd/mod_fcgid/mod_fcgid-2.3.7.tar.gz
tar xvfz mod_fcgid-2.3.7.tar.gz
cd mod_fcgid-*
APXS=/opt/apache2/bin/apxs ./configure.apxs
make
sudo make install

For using PHP install php-cgi

add httpd.conf

FcgidMaxProcesses 50
FcgidFixPathinfo 1
FcgidProcessLifeTime 0
FcgidTimeScore 3
FcgidZombieScanInterval 20
FcgidMaxRequestsPerProcess 0
FcgidMaxRequestLen 33554432
FcgidIOTimeout 120

in each vhost

Options Indexes ExecCGI
AddHandler fcgid-script .php
FCGIWrapper /usr/lib/cgi-bin/php5 .php

farbige man pages

Man pages sind nicht immer sehr übersichtlich. Die man pages etwas einzufärben hilft!

ans Ende der .bashrc

export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'

schon sind die man pages in Farbe.

Author Archive

Archives by Month: