How To Mark Google Auto-Placed Ads as Advertising

For some time now, Google Adsense offers the option of having Adsense automatically place ads on a website. This leaves the ad positioning to Google’s AI. Ideally, this can lead to better advertising revenue. There’s just one catch: the ads aren’t always labeled as adverts or adverts.

The Problem With Auto-Placed Ads

If Google Adsense automatically inserts advertisements into a website, these should of course also be marked as advertisements. But what if that is not the case? After all, as a webmaster you don’t know where Google is placing the ads – especially since that can change permanently.

Read more

PHP: How Can I Find Out, Whether A Number Is Odd Or Even With The Modulo Operator?

There is a simple way in PHP to find out, wheather a number is odd or even. All you need is the modulo operator.

What is the modulo operator?

The modulo operator in PHP is represented by an %. With this operator you can determine the rest of an interger division.
Here’s an example:

Read more

3 Great HTML5 Attributes That Simplify Coding

HTML5 offers a lot of new features, which were, in my opinion, long overdue. In this article i will show you three great new HTML5 attributes which will make coding your HTML5 Website easier.

placeholder-Attribute

Do you know this placeholder texts within form fields like e.g. “Enter your email adress here”? Well with HTML5 you can add placeholders quite easily to your form fields. Just add the placeholder attribute to your form tag. No Javascript or other hacks needed anymore.

Read more

How to insert special characters like &, < and > into a JSF component

If you want to insert a character like & e.g. within a JSF (Java Server Faces) component’s value attribute, you might get an error. To avoid this you must insert a HTML-Entity for the character. Here is a short list for common characters which you might need to replace in your JSF component. Character Entity … Read more

How To Load A Default Image In HTML, If Image Is Not Found

When creating HTML pages, it can always happen, that you include images into a page that can not be displayed. There are several reasons for this, for example when there is a typo in the source code or the image file has been moved or deleted. In this case, using the JavaScript event handler onerror … Read more

How To Limit Post Revisions In WordPress

When I write a post in WordPress, I always push the “Save Draft” button in between. WordPress then stores the article in the database as a separate revision. So each time I save my draft, a new record is added to the database.
The revisions for a small article like this are stored in several records in my WordPress database. Altough only one of them is published. This mechanism gives you some kind of versioning of your articles, but it also produces a lot of overhead in the database, because the records remain in the database and “inflate” it unnecessarily.

Fortunately, you can configure how WordPress handles the revisions. It is possible to completely disable revisions, or limit to a maximum amount of revisions per post.

Read more