Author Archive

PHP UTC timestamp

Posted by on Tuesday, 23 March, 2010

$utc_str = gmdate("M d Y H:i:s", time());
$utc = strtotime($utc_str);

mysqldump on other host – an example

Posted by on Monday, 15 March, 2010

Just so i do not forget it:

mysqldump -hservername –user=backupuser –password=backupuserpassword –verbose databasename > backupfile.dmp

notes:
-h<servername> has no space between the -h flag and the hostname. No idea how they came to that idea.
<backupuser> has to has loginrights from any host or from your host table (the usual local user will not work)
<backupuser> needs LOCK TABLE permission for that DB
–verbose makes your live much easier

Was tötet die Radfahrer

Posted by on Thursday, 4 February, 2010

Allgemein wird gerne angenommen Radfahren sei gefährlich. Das ist richtig.  Allerdings nicht – wie viele glauben – durch Missachtung der Verkehrsregeln durch Radfahrer. Eine Studie hat 2.752 Unfälle mit Autos und Radfahrern untersucht.

Ergebnis: 90 % der Unfälle werden von Autos verursacht. Gründe dafür: Missachtung von Verkehrszeichen und Roten Ampeln, Abiegen in die Spur des Radfahrers oder öffnen einer Tür in die Spur eines Radfahrers.

Details: NY Times

Persönliche Notiz: Fast-Unfälle 2009: eimal gestreift von Rechtsabbieger, einmal fast getroffen von einem Autofahrer der bei Rot in die Kreutzung gefahren ist, einmal an Engstelle durch eine Vorrangsverletzung des Autofahrers gefährdet.

Importing a SVN dump it a new repository

Posted by on Wednesday, 13 January, 2010

Do the dumping on the old repository

svnadmin dump /var/oforge/svn/PROJJECT_NAME > DUMPFILE

Importing in the new repository

svnadmin load /data1/svnroot/grz_yy_test/ < DUMPFILE

Note that the whole structure in imported/exported, so mind existing /trunk directories

Ambrose Bierce new year’s resolutions

Posted by on Saturday, 2 January, 2010

I do hereby firmly resolve that during one year from date I will not drink any spirituous, vinous or malt liquors of any kind whatsoever, except in case I may think it would be a good thing to temporarily suspend this pledge. I will not utter a profane word – unless in sport – without having been previously vexed at something. I will make use of no tobacco in any of its forms, unless I think it would be kind of nice. I will not steal no more than I have actual use for. I will murder no one that does not offend me, except for his money. I will commit highway robbery upon none but small school children, and then only under the stimulus of present or prospective hunger. I will not be false witness against my neighbor when nothing is to be made by it. I will be as moral and religous as the law shall compel me to be. I will run away with no man’s wife without her full and free consent, and never, no never, so help me heaven! will I take his children along. I won’t write any wicked slanders against anybody, unless be refraining I should sacrifice a good joke. I won’t whip any cripples, unless they come fooling about me when I am busy; and i will give all my roommates’ boots to the poor.

regEx in UltraEdit

Posted by on Thursday, 10 December, 2009

Problem:

A list with http connection speeds
01:00:20 (49.79 KB/s) - `logs/http-mon-arl.txt' saved [1000000/1000000]
01:00:21 (48.56 KB/s) - `logs/http-mon-arl.txt' saved [1000000/1000000]
01:00:28 (361.03 KB/s) - `logs/http-mon-arl.txt' saved [1000000/1000000]

Now the KB/s should be added with a leading space if it’s 2-digit

UltraEdit speaks its own dialect of regular expressions but i prefer the pearl-style

So replace

\((\d\d\.)

with

( \1

Explaination:

( goups matches for backreferences, so it’s masked as \(
Start grouping by (
\d\d – 2 digits
. metachar matches anything so its masked as \.
) closes the backreference-group

Replaced by a simple ( and the referenced group \1 within the unmasked  ()
01:00:20 ( 49.79 KB/s) - `logs/http-mon-arl.txt' saved [1000000/1000000]
01:00:21 ( 48.56 KB/s) - `logs/http-mon-arl.txt' saved [1000000/1000000]
01:00:28 (361.03 KB/s) - `logs/http-mon-arl.txt' saved [1000000/1000000

Liferay – adding a Type to the Web Content (former Journal)

Posted by on Monday, 7 December, 2009

Adden of a Web Content Type

You can not do this via the GUI, you have to edit the property files

in WEB-INF\classes\portal-ext.properties: create key

# Article Types to webContent - added jobAnnouncement
journal.article.types=announcements,blogs,general,news,press-release,test,YOUR_CONTENT_TYPE

in  WEB-INF\classes\content\Language-ext.properties: resolving the language key

YOUR_CONTENT_TYPE=Name of your Content type displayed

Apache, Oracle 8.1, php – what can go wrong

Posted by on Thursday, 26 November, 2009

Usualy  it’s no big deal, uncomment

extension=php_oci8.dll

in php.ini and you are ready to go.

If you are unlucky you can have an outdated oracle instance you can not upgrade (say oracle 8.1)

This might result in erros like

Entry point OCIStmtPrepare2 could not be located

or

OCI.dll could not be loaded

This means you’re apache has problems accessing the OCI.dll in your oracle/bin directory. Or the versions may be incompartible. Or something may be very wrong with your Oracle installation. Anyhow, there is a very dirty hack:

  • Get the Oracle instant client, extract it
  • Copy the contents of your instant client to apache/bin (this includes OCI.dll and a lot of other files)
  • Restart Apache
  • Profit!

Another possible error

ORA-12705: Cannot access NLS data files or invalid environment specified

Solution: unset the NLS_LANG variable. This may be in the enviroment, but it may also be in the registry (HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE). A possible good setting might be AMERICAN_AMERICA.WE8MSWIN1252

Longtail Flash Video player Error 2032

Posted by on Tuesday, 3 November, 2009

Longtail is one of the best flv players out there, but it has some shortcommings:

Missing callback function closeplayer

Internt Explorer has currently problems with IE 8 (IE 6 confirmed). This results from a missing callback function. Solution in wordpress enviroment:

<span id="flashholder">
<span id="mplayer">
<!-- here's your standard flash link, the rest does the magic -->
</span>
</span>

<script>

function closeplayer() {
document.getElementById(‘flashholder’).removeChild(document.getElementById(‘myplayer’));
}

window.onbeforeunload=’closeplayer()’

</script>

Found at longtail support forums

Accessing XML playlists over SSL may cause problems

Restrictive session settings cause IE to keep flash from accessing the downloaded xml file myextractXML.php.

Bad HTTP headers:

Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache

Good HTTP Headers

Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: private, max-age=-1 pre-check=-1
Pragma: public

You can experiment with php.ini configs
session.cache_limiter = private
session.cache_expire

But you’ll experience IE 6 chaching problems (IE 6 must die).

Best to set the headers correctly in the files you deliver. In wordtube it’s myextractXML.php

Using wget with proxy on windows

Posted by on Wednesday, 7 October, 2009
If the enviroment variable http_proxy is set wget will automaticly use it

set http_proxy=http://12.34.56.78
wget -proxy on http://iserver09.example.com/
set http_proxy=