Quick Optimization League of Legends Plug-ins

0

The images were eating away the low amount of bandwidth I own (see also the scary red bar on the usage summary) so I put low resolutions images on the LoL Plug-ins Demo page and centralized the image storage. If it becomes too popular I might need to re-locate though *EEK*

Thanks for visiting, come again!

p.s. High resolution images are still available in the code repository.
p.p.s. Clicking on advertisement banners will give me more bandwidth or just donate :)

*update* I put the images on the Amazon Simple Storage Service (Amazon S3) which should provide some stress relief, well at least it scales better!

Help me get friends!

0

Always nice to have friends which notice something like this:

And send it with this message:

Sooo lonely, i am so lonely :-)

Thanks Christoph ^_^ and FU Facebook

League of Legends jQuery-UI Plug-ins Released

2

I (finally) found time to spend a couple of nightly coding sessions to create some League of Legends jQuery Plug-ins, it’s a project that was becoming a never ending story. It is an open source project and uses a lot of cool technology like jQuery and CSS Sprites. With it you can create all the champion builds/pages you desire. I already had an awesome code contribution and I’m hoping for more  community feedback.

Enjoy!

FULL DEMO

More info and demo’s at http://ingol.nl/blog/jquery-league-of-legends-plugins/

League of Legends Forum Posts

http://eu.leagueoflegends.com/board/showthread.php?p=2045061#post2045061
http://www.leagueoflegends.com/board/showthread.php?t=705751

More to come …

- League of Legends Champions Plug-in

- Additional features on the current plug-ins to make them more awesome

- Back-end code to create / host your own champion build tool and exchange builds

Final Words

These features will probably not come early because we’re expecting another child soon, maybe with community support we could speed things up greatly, join me at my BitBucket project. If you happen to be Dutch/Belgian and would like to join a LoL Community, take a look at CowClan

Donations will be accepted to buy gifts for the baby / kids ;-)

Spotted my son Joris doing his “Nom Nom Nom Nom” :)

0

The one with the cool Spider-man t-shirt (blue), so proud! We also bought an enormous amount of Lego last weekend, finally a good excuse to spend lot of cash on toys again. For the non-geeks: “Nom Nom Nom”. What we bought:
- http://starwars.lego.com/en-us/Products/7868.aspx#7913 Thanks to my nephew for making him enthusiastic about Star Wars Lego

- http://herofactory.lego.com/en-us/Products/Default.aspx#2063 and http://herofactory.lego.com/en-us/Products/Default.aspx#2142 which can be combined to create: http://herofactory.lego.com/en-us/BuildingInstructions/2063-2142/combi1.aspx (okay, I had to buy both of course, otherwise we’d only have half of the puzzle and I wouldn’t be able to sleep at night)

Testing the Euro in Oracle with Zend_Db – PHP, Character Encoding Mayhem.

0

Just a little code snippet to test inserting and reading special characters (in this case the €) with Oracle and Zend Framework.

References:
ISO/IEC 8859-15
http://en.wikipedia.org/wiki/ISO/IEC_8859-15

Unicode Character ‘EURO SIGN’ (U+20AC)
http://www.fileformat.info/info/unicode/char/20ac/index.htm

CREATE TABLE "EURO_TEST" ( "EURO" VARCHAR2(50 CHAR) )

Zend Framework Controller Action …

   /*
    * http://en.wikipedia.org/wiki/ISO/IEC_8859-15
    * EURO = Hex A4 (Dec 164)
    *
    * Unicode Character 'EURO SIGN' (U+20AC)
    * http://www.fileformat.info/info/unicode/char/20ac/index.htm
    * EURO = UTF-8(hex) 0xE2 0x82 0xAC (e282ac)
    *
    * Oracle Adapter Configuration:
      resources.db.adapter = "Oracle"
      resources.db.params.host = ""
      resources.db.params.username = ""
      resources.db.params.password = ""
      resources.db.params.charset = "AL32UTF8" !!IMPORTANT!!
      resources.db.params.dbname = "..."
      resources.db.isDefaultTableAdapter = true

    * Get Oracle NLS Settings:
    * SELECT * FROM NLS_DATABASE_PARAMETERS;
    */
    public function euroAction ()
    {
        $this->_helper->viewRenderer->setNoRender(true);

        $db = Bootstrap::getDatabase();
        // cleanup a previous test
        $db->delete('EURO_TEST');
        $db->insert('EURO_TEST',array('EURO'=>'€'));

        echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>Euro Test</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body>';

        /* @var $db Zend_Db_Adapter_Oracle */
        $result = $db->fetchAll("select euro from euro_test");
        // Shows the €
        foreach ($result as $r) {
            echo htmlentities($r['EURO'], ENT_QUOTES, 'UTF-8'); // !!IMPORTANT!!
            echo '<br/>';
        }

        // http://www.techonthenet.com/oracle/functions/dump.php
        $result = $db->fetchAll("select dump(euro, 1016) as eurocode from euro_test");
        // Should show something like Typ=1 Len=3 CharacterSet=AL32UTF8: e2,82,ac.
        foreach ($result as $r) {
            echo $r['EUROCODE'];
            echo '<br/>';
        }

        echo '€';
        echo '</body></head></html>';
    }

See also:

A solution to set various PHP UTF-8 encoding settings for PHP through a .htaccess file can be found in this stack overflow post:

.htaccess settings for UTF-8 encoding support example:

########################################
# Locale settings
########################################

# See: http://php.net/manual/en/timezones.php
php_value date.timezone "Europe/Amsterdam"

SetEnv   LC_ALL  nl_NL.UTF-8

########################################
# Set up UTF-8 encoding
########################################

AddDefaultCharset UTF-8
AddCharset UTF-8 .php

php_value default_charset "UTF-8"

php_value iconv.input_encoding "UTF-8"
php_value iconv.internal_encoding "UTF-8"
php_value iconv.output_encoding "UTF-8"

php_value mbstring.internal_encoding UTF-8
php_value mbstring.http_output UTF-8
php_value mbstring.encoding_translation On
php_value mbstring.func_overload 6

# See also php functions:
# mysql_set_charset
# mysql_client_encoding

# database settings
#CREATE DATABASE db_name
#   CHARACTER SET utf8
#   DEFAULT CHARACTER SET utf8
#   COLLATE utf8_general_ci
#   DEFAULT COLLATE utf8_general_ci
#   ;
#
#ALTER DATABASE db_name
#   CHARACTER SET utf8
#   DEFAULT CHARACTER SET utf8
#   COLLATE utf8_general_ci
#   DEFAULT COLLATE utf8_general_ci
#   ;

#ALTER TABLE tbl_name
#   DEFAULT CHARACTER SET utf8
#   COLLATE utf8_general_ci
#   ;

Firefox 4 Gets a Seal of Approval XD

0

Now lets hope the extensions catch up with this version. Still waiting for Selenium, Pencil, Delicious, etc.

Nice Fresh Retro Implementation of <blink> to Drive People Insane, Enjoy!

0

We needed a nice “test environment” banner on a page and yes, we had the nostalgic idea to put a “under construction” picture with it. Instead I put in a blink, but to adjust the blinking speed we took the jQuery implementation. As a practical joke I “enhanced” the blink code a bit, to really spice it up, code below, enjoy :)

(function($) {
	$.fn.blink = function(options) {
		var defaults = {
			delay : 500
		};
		var options = $.extend(defaults, options);

		return this.each(function() {
			var obj = $(this);
			setInterval(function() {
				var color = "#";
				var hex = '0123456789ABCDEF';
				for (var i = 0; i<6; i++) {
					var r =  Math.round(Math.random() * 16);
					color += hex[r];
				}				

				var color2 = "#";
				for (var i = 0; i<6; i++) {
					var r =  Math.round(Math.random() * 16);
					color2 += hex[r];
				}

				var size =  Math.round(Math.random() * 20) + 10;				

				var aran = Math.round(Math.random() * 3);
				var a = ['left','right','center'];

				$(obj).css({'text-align':a[aran],'background-color':color2,'color':color, 'font-size': size+'px'});
				if ($(obj).css("visibility") == "visible") {
					$(obj).css('visibility', 'hidden');
				} else {
					$(obj).css('visibility', 'visible');
				}
			}, options.delay);
		});
	};
}(jQuery));

$('#blink').blink({delay:400});

Posting Form Data via jQuery Ajax, a Code Snippet

0

You can test the code below in jsFiddle.

</pre>
<form id="myform"><input type="text" name="ok" value="cute" />
 <input type="submit" /></form>
<pre>
$(function(){
    $('#myform').submit(function(){
        var values = {};
        $.each($(this).serializeArray(), function(i, field) {
            values[ field.name ] = field.value;
        });

        values['custom-param'] = 'value';

        $.ajax({
            // mimeType: 'application/json',
            // contentType: 'application/json',
            type: "POST",
            async : false, // 'false' if I want code behind this call to handle response data
            url: 'myurl',
            data: values,
            dataType: 'json',
            success: function(response, textStatus) {
                if (response) {
                    // ^_^
                    console.debug(response);
                } else {
                    // x_x
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                // x_x
            }
        });

        // do more useful stuff

        return false;
    });
});

If you happen to use Zend_Rest_Route (like me often) be careful when using “PUT” because the parameters will not be found in the request, you would probably need to serialize the “values” array with the json2.js library like:

data: JSON.stringify(values),
contentType: 'application/json; charset=utf-8',

which should be JSON decoded server side. Or just perform a POST at the REST path with an ID included in the path because that call will actually trigger the PUT action (which in my opinion is kinda weird, would rather have it fail but I can understand the logic). Don’t know why ZF doesn’t just parse the parameters on a PUT request if the content type is ‘application/x-www-form-urlencoded’.

Go to Top