dENiZEN “Shine a Light for Nature”

17. 5. 2012


extract sub parts from strings in php

26. 4. 2012

may be by following functions will be easyer to extract the
needed sub parts from a string:

after ('@', 'biohazard@online.ge');
returns 'online.ge'
from the first occurrence of '@'

before ('@', 'biohazard@online.ge');
returns 'biohazard'
from the first occurrence of '@'

between ('@', '.', 'biohazard@online.ge');
returns 'online'
from the first occurrence of '@'

after_last ('[', 'sin[90]*cos[180]');
returns '180]'
from the last occurrence of '['

before_last ('[', 'sin[90]*cos[180]');
returns 'sin[90]*cos['
from the last occurrence of '['

between_last ('[', ']', 'sin[90]*cos[180]');
returns '180'
from the last occurrence of '['

function after ($this, $inthat)
{
if (!is_bool(strpos($inthat, $this)))
return substr($inthat, strpos($inthat,$this)+strlen($this));
};

function after_last ($this, $inthat)
{
if (!is_bool(strrevpos($inthat, $this)))
return substr($inthat, strrevpos($inthat, $this)+strlen($this));
};

function before ($this, $inthat)
{
return substr($inthat, 0, strpos($inthat, $this));
};

function before_last ($this, $inthat)
{
return substr($inthat, 0, strrevpos($inthat, $this));
};

function between ($this, $that, $inthat)
{
return before($that, after($this, $inthat));
};

function between_last ($this, $that, $inthat)
{
return after_last($this, before_last($that, $inthat));
};

// USES
function strrevpos($instr, $needle)
{
$rev_pos = strpos (strrev($instr), strrev($needle));
if ($rev_pos===false) return false;
else return strlen($instr) - $rev_pos - strlen($needle);
};

suche nach Textstellen in eine Datei leiten

25. 4. 2012

Zusammen mit find, grep und tee kann man ganze Verzeichnisbäume durchsucht und das Ergebnis in eine Textdatei geschrieben werden. Man sollte nur darauf achten, wenn man die Textdatei so benennt wie den Suchbegriff, dass dann die Textdatei in einem tieferem Verzeichnis liegt. Sonst entstehen Rekursionen.
find ./ -exec grep -H "versandliste" {} \; | tee ../suchgrep/versandliste.txt


5000m Rennen

19. 4. 2010

so müssen 5000m Rennen sein, dann macht Leichtathletik richtig Spass:

Track and Field Videos on Flotrack


Laufen in Iten, Kenia

22. 3. 2010

die Radarfalle hat sie erwischt

13. 3. 2010


Gatorage

12. 3. 2010


Sportwerbung

8. 3. 2010

wo wir gerade beim Thema Sport und Werbung wären:


ein Laufband mal anders

8. 3. 2010


Asics Running Film

23. 2. 2010

Asics Running Film from PostPanic on Vimeo.