MySQL/SQL: count chars in table field

SELECT CHAR_LENGTH(field)-CHAR_LENGTH(REPLACE(field,’-',”)) AS count FROM table

PHP Websocket Class new Version

Auf Anfrage einiger Leser habe ich jetzt die Klasse kommentiert und Informationen zur Lizenz hinzugefügt. An der Funktionalität hat sich nichts geändert. Die aktuelle Version 1.0.5 ist unter folgender URL zu finden: http://bohuco.net/labs/php-websocket-class/lib/WebSocketServer1.0.5.php.txt

Read the rest of this entry »

News Update for Web-Developers – Week 44

Read the rest of this entry »

Javascript Array Case-insensitive Sorting

easy if you know how …

 
myarray.sort(function(a, b){
    return a.toLowerCase() > b.toLowerCase();
});

WordPress Quicky: Query Posts by Custom Meta Field

If you have already added a custom meta field to your wordpress posts with add_meta_box you probably want to query such posts in your template. You can do that with query_posts(), it supports the meta_key and meta_value attributes.

 
query_posts($query_string.'&meta_key=onStartpage&meta_value=1');

WordPress Quicky: Add User Profile Fields

If you want add fields to the wordpress user profile then two hooks are important for you.
Read the rest of this entry »

WordPress Quicky: Use the [Shortcode] API

Another quicktipp for wordpress plugin developers. With the shortcode API you can easily provide additional commands for wordpress authors …

Read the rest of this entry »

WordPress Quicky: Exclude Categories

Another quicktipp for wordpress theme developers.

If you want to exclude one or more categories from a page (startpage, category-page), you can call the query_posts function with negative category-ids …

<?php query_posts($query_string . '&cat=-1,-2,-3'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <!-- POST -->
<?php endwhile; endif; ?>

WordPress Quicky: Register Sidebar Widget with 3.0

Another quicktipp for wordpress plugin developers. Registering a sidebar widget can end with a fatal error if you use the code from the wordpress documentation …

Read the rest of this entry »

Use Google Closure Compiler Local with PHP

In “Google Closure Compiler with PHP” i described how you can use the compiler online via http. Now i will show how you do it local on your server with the java command line application …

Read the rest of this entry »