TypoScript Syntax Highlighting für Notepad++

Posted: 7th November 2011 by Peter Hilbring in Computer
Tags:

Nach längerem Suchen nach einem TypoScript Syntax Highlighting für Notepad++ bin ich endlich auf der russischen Seite ValidCat fündig geworden.

Dort werden die Dateien „userDefineLang.xml“ (Syntax Highlighting) und „typoscript.api“ bzw. „typoscript.xml“ (Auto Vervollständigung) zum download angeboten.

Die Datei userDefineLang.xml muss in das Verzeichnis %appdata%\Notepad++ und die Datei typoscript.api und/oder typoscript.xml in das Verzeichnis c:\Program Files (x86)\Notepad++\plugins\APIs\ kopiert werden.

Nach einem Neustart von Notepad++ stehen die neuen Erweiterungen zur Verfügung.

YouTube – 500 Internal Server Error

Posted: 15th Oktober 2011 by Peter Hilbring in Allgemeines
Tags:

If you see them, show them this information

Das wurde mir heute Nacht von meinem Kollegen Gregor zugeschickt ;-)

WordPress Plugin: googleCards Patch 20110830

Posted: 30th August 2011 by Peter Hilbring in Computer, WordPress
Tags: , , ,

Hier ist die nächste Patchrunde (Stand 30.08.2011):

--- googleCardClass.php.orig    2011-08-30 14:01:28.000000000 +0200
+++ googleCardClass.php 2011-08-30 14:02:49.000000000 +0200
@@ -124,7 +124,7 @@
        protected function parseHtml()
        {
                // parse the html to look for the h4 'have X in circles' element
-               preg_match('/<h4 class="nPQ0Mb pD8zNd">(.*?)<\/h4>/s', $this->html, $matches);
+               preg_match('/<h4 class="Pv rla">(.*?)<\/h4>/s', $this->html, $matches);
                if (isset($matches) && !empty($matches))
                {
                        $count = $matches[1];
@@ -140,7 +140,7 @@
                $name = $matches[1];
                // parse the html for the img div
-               preg_match('/<div class="DzkbSc">(.*?)<\/div>/s', $this->html, $matches);
+               preg_match('/<div class="c-i-Ra-L CK Xu">(.*?)<\/div>/s', $this->html, $matches);
                $img_div = $matches[1];
                // parse the img div for the image src

In der Datei „googleCardClass.php“ müssen wieder die beiden Regular Expressions zur Ermittlung des Zählers und der Profilbild-URL angepasst werden.

Außerdem darf nicht vergessen werden die Datei „wp-content/cache/plus_cards.txt“ zu entfernen.

WordPress Plugin: googleCards Modifikation

Posted: 27th August 2011 by Peter Hilbring in Computer, WordPress
Tags: , , ,

Für mein Blog benutze ich das googleCards Plugin von Majubo.

Leider ändert Goggle im Moment alle paar Tage  die Bezeichnung der CSS Klassen, sodass das Plugin jedes Mal angepasst werden muss. Ich habe die Regular Expressions zum Suchen des Profilbildes und des „In X people’s circles“ Elements so angepasst das die GoogleCard mit den Änderungen vom 27.08.2011 wieder korrekt angezeigt wird. Zusätzlich habe ich einen Patch für das PHP-cURL Dualstackproblem hinzugefügt.

--- googleCardClass.php.orig	2011-08-04 16:07:22.000000000 +0200
+++ googleCardClass.php	2011-08-27 16:34:51.000000000 +0200
@@ -5,6 +5,10 @@
 *	http://plusdevs.com
 *	http://plusdevs.com/googlecard-googleplus-php-scraper/
 *
+*	Modified to match google+ classes from 2011/08/27 (see lines 128, 144)
+*	Added cURL IPv4 Patch (see line 170)
+*	Peter Hilbring
+*
 *	This program is free software: you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation, either version 3 of the License, or
@@ -121,8 +125,7 @@
 	protected function parseHtml()
 	{
 		// parse the html to look for the h4 'have X in circles' element
-		preg_match('/</pre>
<h4 class="a-b-Fa-ug">(.*?)/s', $this->html, $matches);
-
+ preg_match('/</h4>
<h4 class="nPQ0Mb pD8zNd">(.*?)/s', $this->html, $matches);
 if (isset($matches) && !empty($matches))
 {
 $count = $matches[1];
@@ -138,12 +141,12 @@
 $name = $matches[1];
 // parse the html for the img div
- preg_match('/</h4>
<div class="a-R-Z-z-M">(.*?)/s', $this->html, $matches);
+ preg_match('/
<div class="DzkbSc">(.*?)/s', $this->html, $matches);
 $img_div = $matches[1];
 // parse the img div for the image src
 preg_match('/< *img[^>]*src *= *["\']?([^"\']*)/i', $img_div, $matches);
- $img = 'http:' . $matches[1];
+ $img = 'https:' . $matches[1];
 // put the data in an array
 $return = array('id' => $this->user_id, 'count' => $circles, 'name' => $name, 'img' => $img, 'url' => $this->url);
@@ -164,6 +167,7 @@
 curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, true);
 curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, false);
 curl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, false);
+ curl_setopt($this->curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
 // execute the call to google+
 $this->html = curl_exec($this->curl);
+?>

Zur Inbetriebnahme reicht es aus die Datei „googleCardClass.php“ einfach in das Verzeichnis „wp-content/plugins/googlecards/“ zu kopieren und die vorhandene Datei zu überschreiben. Die eventuell vorhandene Datei „wp-content/cache/plus_cards.txt“ muss auf jeden Fall gelöscht werden.

Downloads

googleCard Modifications
Titel : googleCard Modifications
Beschriftung : Klassendatei und Patch
Dateiname : googleCard-modifications.zip
Size : 4 kB

PHP cURL Dualstack DNS Problem

Posted: 25th Juli 2011 by Peter Hilbring in Computer
Tags: , ,

In einer Dualstackumgebung benutzt die PHP cURL Funktion IPv6 zur Namensauflösung.

Probleme treten nun auf wenn die Zieldomain keine IPv6 Adresse besitzt da die Library dann nicht auf IPv4 zurück fällt. In der cURL C-API gibt es Parameter um eine IPv4 Namensauflösung zu erzwingen. Seit PHP 5.3 funktioniert diese nun auch mit der PHP cURL Funktion.

Um die IPv4 Namensauflösung zu benutzen trägt man die folgende Zeile als curl_ setoption in sein PHP Script ein:

curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);

Dieses beseitigt das Problem zwar nicht wirklich, schafft jedoch erst einmal einen guten Workaround.