Author Archive

HTTP Uploads larger than 2 GB

Posted by on Tuesday, 28 September, 2010

Do not work – I ran into a problem trying to make the upload size for one of my application bigger. Firefox, Internet Exporer and Safari all failed. The reason: they mess up the headers – Content-Length does an overflow

POST /uploadtest.php HTTP/1.1
User-Agent Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; )
Content-Type multipart/form-data; boundary=---------------------------7da301630063a
Accept-Encoding gzip, deflate
Content-Length -156552375
Pragma no-cache

A simple PDO example

Posted by on Monday, 27 September, 2010

// create PDO Database connection
try {
$dbh = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass);
} catch(PDOException $e) {
echo $e->getMessage();
// prepare the statemant
$sql = $dbh->prepare("
city, count(city), sum(counter) cnt
from geoip
country_name = :countryname
group by city;
// replace the bind parameters with variables
$sql->bindParam(':countryname', $countryname, PDO::PARAM_STR);
// execute the statemant
// check for errors - PDO catches them silently
if ($sql->errorCode() != '0000' ) {
$msg = $sql->errorInfo();
throw new Exception($msg[2]);
// iterate over the results
foreach ($sql as $row) {
echo "access via index: " . $row[0] . "\n";
echo "access via associative array: " . $row["cnt"] . "\n";

Oracle 10 Client on Windows 7

Posted by on Tuesday, 17 August, 2010

If you need the full Oracle Client on your Win7 machine, you are in a bit of trouble.

Windows 7 is internal windows 6.1 and the setup routine checks for windows 5, 5.someting and 6.0. So no Windows 7.

But there is a hack: turn off the system check with the flag -ignoreSysPrereqs

so running

setup.exe -ignoreSysPrereqs

form a cmd does the trick. You’ll have to overwrite the error later in the setup routine by clicking the failed checkbox.

mysql: removing a timestamps on update CURRENT_TIMESTAMP

Posted by on Monday, 2 August, 2010

Situation: you have a table and a timestamp in it. Thee is a on update CURRENT_TIMESTAMP on the column. But you want to get rid of it:


cwrsync 4.0.4 to UNC Paths

Posted by on Thursday, 15 July, 2010

It seams to me that handling of UNC paths changed since the last version i used. After some pain i am now able to sync from europe to china again. Here are some hints for other poor souls that may prove helpfull:

* If you are using rsync on windows to sync to an UNC Path (\\server\some\path) on the receiving end – be sure to run the service as an account that can access the share. In my case a domain user was needed, the local service account  (svccwrsync) failed of course

* UNC Paths worked previously like this (in rsyncd.donf):
path    = \\fshsmsxxx\d$\Public Share\Engineering\somePath

Not any longer. Now with rsync 3.07 its
path    = //fshsmsxx/d$/Public Share/

rsync on windows chown failed: Invalid argument (22)

Posted by on Monday, 12 July, 2010

Using cwrsync 4.04 a lot of  “chown failed: Invalid argument (22)” showed up.

After some research the following tricks removed those annoying erros:

In rsyncd.conf set user and group to :
uid = 0
gid = 0

in the rsync call, replace -a (which is short for -rlptgoD (recursive, copy symlinks, preserve permissions, preserve modification times,  preserve group,  preserve owner , preserve device files,preserve special files  ) )
with -rt (recursive, preserve times)

Now using
rsync –super –recursive –delete –compress –times testSource CWsync@targetServer::testDestination

see for details

Remotly killing a RDP Session

Posted by on Wednesday, 2 June, 2010

Server full, or a session handing .. you know it’s a pain. But how to remotly get you a free session?

First check the sessions

qwinsta /server:<servername>

console                        0                                     Verbunden                                    wdcon
rdp-tcp                     65536                              Bereit                                               rdpwd
rdp-tcp#5               xxchr95                         2                                      Aktiv       rdpwd
rdp-tcp#13            xxkla19                           1                                     Aktiv        rdpwd

Then, kick a sesson

rwinsta 2 /server:<servername>

Where 2 is the Session Id from the qwinsta command

Or, if you happen to be admin on the target machine take over the console RDP session

mstsc /console /v:<server>

Find out what mysql queries are slow

Posted by on Wednesday, 2 June, 2010

So you are using mysql and have some data in your DB … say 2 million rows or something.  Not it’s about time to see how your SQL queries are doing, do some profiling, but … but how to you find out what sql queries are slow? Where you are missing that index? Try the following in your mysql.ini

#enable slow query logs
log-slow-queries = d:/your/path/to/log/slow.log
# default of “slow” is 10 seconds, set it to 1
long_query_time = 1
# log *EACH AND ANY* query not using an index (this may be a lot till you fix it)

Then you see where you’re not using the index, where you forgot it. Maybe use EXPLAIN on some of your longer queries to find out how to improve them

#enable slow query logs
log-slow-queries = d:/phpapps/xampp/mysql/log/slow.log
# default of "slow" is 10 seconds, set it to 1
long_query_time = 1
# log *EACH AND ANY* query not using an index (this may be a lot till you fix it)

IIS and Apache both on Port 80

Posted by on Wednesday, 5 May, 2010

IIS takes up all IP adresses by default.

Use programm httpcfg ( part of MS 2003 support tools) to solve the problem

net stop http /y
net stop w3proxy
httpcfg delete iplisten -i
httpcfg set iplisten -i xx.xx.xx.xx
net start http
net start w3svc
net start w3proxy

VBS Database connection to MySQL usting ODBC

Posted by on Thursday, 15 April, 2010

Damn, this feels dirty …

Sub LogDateiInMSql(query)
db_server = "localhost"
db_user = "root"
db_pass = ""
db_name = "eparcel"

' init connection to MySQL
Set conn=CreateObject("ADODB.Connection")

' you need the odbc driver installed, obviously
strConnectString = "DRIVER={MySQL ODBC 5.1 Driver};" & "SERVER=" & db_server & ";" _
& " DATABASE=" & db_name & ";" & "UID=" & db_user & ";PWD=" & db_pass & "; OPTION=3"

conn.Open strConnectString

If conn.State = 1 Then
MsgBox "connected"
MsgBox "connection failed"
End If
Set rs=CreateObject("ADODB.recordset")

Set rs = conn.Execute(Sql)
Do While not rs.EOF
MsgBox rs(0)

End Sub

LogDateiInMSql("show tables")