dracoblue.net

DCallbacks 1.1 released

Today I have a little update for the DCallbacks library. Its been about one year since it was updated last time, so 0.2 of samp is released and the user [em]NeedAName[/em] found an issue, while using the library.

So I took some minutes, fixed that issue, and released DCallbacks 1.1.

In dcallbacks, open source, pawn by DracoBlue @ 25 Nov 2007 | 51 Words

Fast in_array or in_list implemented Lua?

On lua mailing list somebody asked if there is any way to check very short if an element is in a specific list of elements.

In php you would do for example

if (in_array("A",array("A","B","C")) ) { echo "hello"; }

Of course, everyone can write a short in_table function in lua:

Continue reading ...

In lua, open source by DracoBlue @ 11 Nov 2007 | 260 Words

Hellgate:London Server Status for your Guildpage/FanSite

How to add the Hellgate:London-Server Status to your Website? Thats quite easy!

Default icons: The image: results in:

Custom icons: Add that little html+javascript code to your website and it will load the on.png or off.png in your webfolder! Of course you can change this source snippet so it fits your needs!


All you need to use is the correct Server-ID:

[ol]
  • Shulgoth US
  • Sydonai EU
  • Alliance
  • Command
  • Korea
  • Test Center
  • [/ol]

    XML for the geeks: I have also finished an xml-feed at [em]http://hglondon.net/server/list.xml[/em] so if you are expirienced in xml-encoding you can write a interpreter for it in any language you want!

    In hglondon.net, project by DracoBlue @ 09 Nov 2007 | 134 Words

    PHP script to order builds, release numbers and versions

    I had the problem, that I wanted to sort an array of builds by name, but names could be 1.1 or, 2.10.0.1 or even 2.0.9.

    Thatswhy I made the following sort alogrithm in PHP by using usort and an own compare function.

    function builds_sort($a, $b) {
        if ($a['name']==$b['name']) {
            return 0;
        }
        $ap=explode('.',$a['name']);
        $bp=explode('.',$b['name']);
        foreach ($ap as $pos => $number) {
            if (!isset($bp[$pos])) {
              return 1;
            } elseif ($number > $bp[$pos]) {
              return 1;
            } elseif ($number < $bp[$pos]) {
              return -1;
            }
        }
        return -1;
    }
    
    // Testarray
    $builds=array(
        array("name"=>"2.1.0","id"=>"210","suite_id"=>1),
        array("name"=>"2.1.1","id"=>"211","suite_id"=>1),
        array("name"=>"3.0.0","id"=>"3","suite_id"=>1),
        array("name"=>"10","id"=>"3","suite_id"=>1),
        array("name"=>"2.1.10","id"=>"2110","suite_id"=>1),
        array("name"=>"2.1.2","id"=>"212","suite_id"=>1)
    );
    
    usort ($builds,"builds_sort");
    

    This function sorts each element by "name" with DESC.

    In open source, php by DracoBlue @ 06 Nov 2007 | 113 Words

    Workaround for UTF-8 issues with PHP's imagestring

    Some of you may have expirienced the issue, that php's

    imagestring-function doesn't properly show UTF-8 characters.

    As workaround you can use the imagettftext-function.

    When using imageTTFtext instead of imagestring, you have to know, that you don't use the $font-ids from PHP, instead you use fontfiles.

    So:

    imagestring ( resource $im, int $font, int $x, int $y, string $s, int $color )
    

    becomes to:

    imagettftext ( resource $im, int $size, int $angle, int $x, int $y, int $color, string $fontfile, string $text ) 
    

    Keep $angle=0 if you want just horizontal-text. Hope that helps!

    In open source, php, utf-8 by DracoBlue @ 04 Nov 2007 | 105 Words

    Page 37 - Page 38 - Page 39