Tag: programmeren

Zelf een krant maken in België?

Na het succes van het zelf krant maken in Nederland, waar ik al eerder over schreef, is nu ook een Belgische variant gelanceerd. Op http://www.zelfkrantmaken.be kan je nu ook je eigen krant maken, speciaal gericht op Belgische bezoekers.

Dus heb je een feestje, een jubileum, een opdracht voor school of gewoon zin om een voorpagina van een krant te maken? Ga dan naar http://www.zelfkrantmaken.nl of http://www.zelfkrantmaken.be

MySQL: Delete using join

For deleting orphaned children in a relational database I tried deleting those children using a ‘LEFT JOIN’ on the ‘mother’ table to find the children. With the select I used the normal approach and found all those poor kids. Changing the SELECT * into DELETE did not work. You’re not allowed to DELETE on the used table. First I thought a subquery could help me, NOT 🙂

The solution is to use the keyword USING.

An example:

DELETE FROM t1 USING t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t2.id IS NULL

In this way you can use as many joined tables for deleting, without affecting those joined tables

After testing I found out this also worked for me:

DELETE t1 FROM t1 LEFT JOIN t2 ON t2.id = t1.id WHERE t2.id IS NULL

I didn’t use the ‘FROM’ and don’t use aliases for your table you wish to clean. That won’t work!

WordPress XML response issues (-32700:parse error)

Is wordpress giving you -32700:parse error. not well formed? Or is xmlrpc.php bothering you while getting getCategories function XML RPC call?
I did and i’ve found the problem:

In the IXR_Message class, the class which I use and also is recommended to parse the XML response of xmlrpc.php, uses preg_replace in the function parse() (IXR_Message->parse();). In PHP5 there has been some restrictions introduced to recursive regular expressions with Perl. Some parameters has been introducted to your php.ini (backtrack limit) and one of them is preventing me to interpret the XML-feed I get from my WordPress. Perhaps this one is very big, but i really need it, so:

Change at the beginning of your script your settings for example:
ini_set('pcre.backtrack_limit', 10000000);

You will see that the IXR_Message class is happy with the result it gets from the first lines of its parse function.

If you want to test if the backtrack limit is bothering you use the preg_last_error() function:

if (preg_last_error() == PREG_BACKTRACK_LIMIT_ERROR) {
print 'Backtrack limit was exhausted!';
}

The code in the parse() function is:
$this->message = preg_replace('/<\?xml(.*)?\?'.'>/', '', $this->message);

Zelf een krant maken?

Je kent dat wel, heb je een feestje of een jubileum, wil de familie een krant maken… Hoe ga je dat nu aanpakken. In Word is dat echt niet leuk en verstand van allerlei DTP pakketten ontbreekt ook 9 van de 10 keer. En dan moet je alle kollommetjes enzo nog indelen!

Daar is nu een oplossing voor gevonden: zelfkrantmaken.nl Daar maak je eenvoudig met klikken op de verschillende kolommen en foto’s je eigen voorpagina van je krant. En het makkelijke daarna is dat je ‘m gewoon als PDF kunt opslaan en uit kunt printen op a4, a3, a2, wat je maar wilt!

Wil je met meerdere er aan werken? Dat kan ook, mail gewoon de link door naar je medeschrijvers en zij kunnen mee helpen je krant te vullen. Je foto’s worden vanzelf op maat gemaakt en bij het bewerken van de teksten zie je meteen hoeveel je nog over hebt, of dat je er overheen gaat.