<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>André Abt</title>
	<atom:link href="http://www.andre-abt.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.andre-abt.com</link>
	<description>Musician &#38; Frontend Web Developer</description>
	<lastBuildDate>Sun, 19 May 2013 21:06:04 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Waterglass Effect with KineticJS</title>
		<link>http://www.andre-abt.com/2013/01/16/waterglass-effect-with-kineticjs/</link>
		<comments>http://www.andre-abt.com/2013/01/16/waterglass-effect-with-kineticjs/#comments</comments>
		<pubDate>Wed, 16 Jan 2013 19:56:56 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Canvas]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JS]]></category>
		<category><![CDATA[KineticJS]]></category>

		<guid isPermaLink="false">http://www.andre-abt.com/?p=2246</guid>
		<description><![CDATA[I needed to code a Waterglass fill effect for a project and this seemed to be a good KineticJS beginner example and a nice topic for a new blog post. I think especially the image preloader is a good learning example. Checkout the demo! You can view the running demo on jsfiddle and play live [...]]]></description>
				<content:encoded><![CDATA[<p>I needed to code a Waterglass fill effect for a project and this seemed to be a good KineticJS beginner example and a nice topic for a new blog post. I think especially the image preloader is a good learning example.</p>
<p><a href="http://jsfiddle.net/monobasic/Vs23S/embedded/result/" target="_blank"><strong>Checkout the demo!</strong></a></p>
<p>You can view the running demo on jsfiddle and play live with the code here: <a href="http://jsfiddle.net/monobasic/Vs23S/" target="_blank">http://jsfiddle.net/monobasic/Vs23S/<br />
</a>From here it would be easy to add more animated layers like shadows and make the animation even more realistic.</p>
<p>&nbsp;</p>
<h2>HTML</h2>
<p></p><pre class="crayon-plain-tag">&lt;!DOCTYPE html&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;meta charset="utf-8"&gt;
        &lt;title&gt;Glass&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;div id="container"&gt;&lt;!-- canvas will be generated here --&gt;&lt;/div&gt;

        &lt;input class="percent" type="text" value="80" /&gt;&lt;button class="button"&gt;change&lt;/button&gt;

        &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"&gt;&lt;/script&gt;
        &lt;script&gt;window.jQuery || document.write('&lt;script src="js/vendor/jquery-1.8.3.min.js"&gt;&lt;\/script&gt;')&lt;/script&gt;
        &lt;script src="js/vendor/kinetic-v4.2.0.min.js"&gt;&lt;/script&gt;
        &lt;script src="js/main.js"&gt;&lt;/script&gt;
    &lt;/body&gt;
&lt;/html&gt;</pre><p>&nbsp;</p>
<p>&nbsp;</p>
<h2>JS (main.js)</h2>
<p></p><pre class="crayon-plain-tag">/*jslint browser: true, sloppy: true, plusplus: true, nomen: true, todo: true*/
/*globals $, jQuery, console, window, Kinetic*/

var glass,
    water,
    levelFull = 70,
    levelEmpty = 300,
    currentWaterY,
    currentWaterScale,
    layer = new Kinetic.Layer(),
    stage = new Kinetic.Stage({
        container: 'container',
        width: 240,
        height: 300
    }),
    sources = {
        bg: 'img/glass_bg.png',
        water: 'img/glass_water.png'
    };

function loadImages(sources, callback) {
    var images = {},
        loadedImages = 0,
        numImages = 0,
        src;
    // get num of sources
    for (src in sources) {
        numImages++;
    }
    for (src in sources) {
        images[src] = new Image();
        images[src].onload = function () {
            if (++loadedImages &gt;= numImages) {
                callback(images);
            }
        };
        images[src].src = sources[src];
    }
}

function changeWaterLevel(level) {
    var newLevelPercent,
        newLevel,
        newScaleX;

    newLevelPercent = parseInt(level, 10);
    if (newLevelPercent &gt; 100) {
        newLevelPercent = 100;
    }

    newLevel = levelEmpty - (100 / levelFull * newLevelPercent);  // calculate new level, 0% is 190px and 100% is 30px
    newScaleX = 1 + (0.3 / 100 * newLevelPercent); // calculate new scale multiplicator, 0% is 1 and 100% is 1.5

    water.transitionTo({
        x: glass.getWidth() / 2 - 3,
        y: newLevel,
        opacity: 1,
        scale: {
            x: newScaleX,
            y: 1
        },
        duration: 1,
        easing: 'ease-out'
    });
}

// load images and init
loadImages(sources, function (images) {
    glass = new Kinetic.Image({
        width: 248,
        height: 275,
        x: 0,
        y: 0,
        image: images.bg
    });

    water = new Kinetic.Image({
        x: glass.getWidth() / 2 - 3,
        y: levelEmpty,
        width: 86,
        height: 20,
        offset: [43, 106],
        image: images.water
    });

    // add the shapes to the layer
    layer.add(glass);
    layer.add(water);

    // add the layer to the stage
    stage.add(layer);

    // add click function to fill the glas
    stage.on('click', function (evt) {
        var mousePosition = stage.getMousePosition(),
            newLevelPx = 148 - mousePosition.y + 50,
            newLevelPercent = parseInt(100 / 148 * newLevelPx, 10);
        if (newLevelPercent &lt; 0) {
            newLevelPercent = 0;
        }
        changeWaterLevel(newLevelPercent);
    });

    // get current values
    currentWaterY = water.getY();
    currentWaterScale = water.getScale();
});

$(document).ready(function () {

    $('.button').click(function () {
        var newLevel = $('.percent').val();
        //console.log('change water level to: ' + newLevel);

        changeWaterLevel(newLevel);
    });

});</pre><p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andre-abt.com/2013/01/16/waterglass-effect-with-kineticjs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery AJAX Loader</title>
		<link>http://www.andre-abt.com/2012/12/16/jquery-ajax-loader/</link>
		<comments>http://www.andre-abt.com/2012/12/16/jquery-ajax-loader/#comments</comments>
		<pubDate>Sun, 16 Dec 2012 12:16:49 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[loader]]></category>

		<guid isPermaLink="false">http://www.andre-abt.com/?p=1760</guid>
		<description><![CDATA[This is a simple jQuery Ajax Loader you can use in your projects. If a Element of the site is loaded via Ajax, just trigger the $(&#8216;#elementToLoad&#8217;).showLoaderPanel(); method before the ajax load, and in the callback of the load function, trigger the $(&#8216;#elementToLoad&#8217;).hideLoaderPanel();. To generate a animated loader .gif, visit this site:  http://www.ajaxload.info/. The CSS: [...]]]></description>
				<content:encoded><![CDATA[<p>This is a simple jQuery Ajax Loader you can use in your projects. If a Element of the site is loaded via Ajax, just trigger the $(&#8216;#elementToLoad&#8217;).showLoaderPanel(); method before the ajax load, and in the callback of the load function, trigger the $(&#8216;#elementToLoad&#8217;).hideLoaderPanel();.</p>
<p>To generate a animated loader .gif, visit this site: <br />
<a href="http://www.ajaxload.info/">http://www.ajaxload.info/</a>.</p>
<p>The CSS:</p><pre class="crayon-plain-tag">.loader {
    display: none; /* hidden on init */
    position: absolute;
    top: 0;
    left: 0;
    background: url(/bundles/epaymentviewer/images/loader_bg.png) top left repeat;
}

.spinner-small {
  height: 16px;
  width: 16px;
  background: url('/bundles/epaymentviewer/images/ajax-loader-small.gif') center left no-repeat;
}

.spinner-medium {
  height: 32px;
  width: 32px;
  background: url('/bundles/epaymentviewer/images/ajax-loader-medium.gif') center left no-repeat;
}

.spinner-big {
  height: 48px;
  width: 48px;
  background: url('/bundles/epaymentviewer/images/ajax-loader-big.gif') center left no-repeat;
}</pre><p></p>
<p>The Javascript:</p>
<p></p><pre class="crayon-plain-tag">(function($) {

        // cool way to find the current element with the highest z-index
        var maxZIndex = Math.max.apply(null, $.map($('body *'), function(e,n){
            if($(e).css('position')=='absolute')
                return parseInt($(e).css('z-index')) || 1 ;
            })
        );

        // show/hide ajax loader panel methods
        $.fn.showLoaderPanel = function (spinnerSize) {

            spinnerSize = typeof spinnerSize !== 'undefined' ? spinnerSize : false;
            console.log(spinnerSize);

            var element, elementOffset, activeLoaderClass, panel, panelWidth, panelHeight, spinner;
            element = $(this);
            activeLoaderClass = 'loader-panel-active';
            panel = $('&lt;div class="ddt-loader"&gt;&lt;/div&gt;');
            spinner = $('&lt;div&gt;&lt;/div&gt;');
            elementOffset = element.offset()

            // check if there is allready a visible loader panel
            if (element.hasClass(activeLoaderClass)) {
                console.log('there is allready a active loader panel!');
                return;
            } else {
                // add class indicator
                element.addClass(activeLoaderClass);
                console.log('generating loader panel..');

                // add parent element indicator
                element.data('panel', panel);
                console.log(element.data('panel'));

                // determine/set size/position of element
                panelWidth = element.width();
                panelHeight = element.height();
                console.log('panelWidth: ' + panelWidth);
                console.log('panelHeight: ' + panelHeight);

                // determine spinner size (sizes 16x16, 32x32, 48x48)
                if (spinnerSize) {
                    // override spinner size
                    spinner.addClass('ddt-spinner-' + spinnerSize);
                } else if (panelWidth &gt; 400 &amp;&amp; panelHeight &gt; 400) {
                    // big spinner
                    spinner.addClass('ddt-spinner-big');
                    console.log('add big spinner class!');
                } else if (panelWidth &gt; 200 &amp;&amp; panelWidth &lt; 400 &amp;&amp; panelHeight &gt; 200 &amp;&amp; panelHeight &lt; 400) {
                    // medium spinner
                    spinner.addClass('ddt-spinner-medium');
                    console.log('add medium spinner class!');
                } else if (panelWidth &gt; 20 &amp;&amp; panelWidth &lt; 200 &amp;&amp; panelHeight &gt; 20 &amp;&amp; panelHeight &lt; 200) {
                    // small spinner
                    spinner.addClass('ddt-spinner-small');
                    console.log('add small spinner class!');
                }

                panel.css('width', panelWidth);
                panel.css('height', panelHeight);
                panel.css('top', elementOffset.top);
                panel.css('left', elementOffset.left);
                panel.css ('z-index', maxZIndex + 1);

                // position and generate spinner
                spinner.css('display', 'none');
                spinner.css('position', 'absolute');
                spinner.css('top', panel.offset().top + ( panel.height() / 2 - 24 ));
                spinner.css('left', panel.offset().left + ( panel.width() / 2 - 24 ));
                spinner.css('z-index', panel.css('z-index') + 1);

                // generate loader panel
                $('body').append(panel);

                // fade in loader panel
                panel.fadeIn(500, function() {
                    $(this).append(spinner);
                    spinner.show();
                });
            }
        };

        $.fn.hideLoaderPanel = function () {
            var activeLoaderClass = 'loader-panel-active';
            var element = $(this);

            // remove class indicator
            element.removeClass(activeLoaderClass);

            if (element.data('panel')) {
                // fadeout and remove loader panel from element
                element.data('panel').fadeOut();
            }
        };

    })(jQuery);</pre><p> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.andre-abt.com/2012/12/16/jquery-ajax-loader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tame Styled Blockquote Quotation Icons Positioning</title>
		<link>http://www.andre-abt.com/2012/08/09/tame-styled-blockquote-quotation-icons-positioning/</link>
		<comments>http://www.andre-abt.com/2012/08/09/tame-styled-blockquote-quotation-icons-positioning/#comments</comments>
		<pubDate>Thu, 09 Aug 2012 11:45:51 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.andre-abt.com/?p=1935</guid>
		<description><![CDATA[Lately I run into a problem with styled blockquote quotation marks. This is a short explanation of the problem and a fix for all modern Browsers and IE&#62;8. If the last line length of the blockquote text was near the right border, the quotation mark was overlapping the text. No Problem with shorter Texts. Let&#8217;s [...]]]></description>
				<content:encoded><![CDATA[<p>Lately I run into a problem with styled blockquote quotation marks. This is a short explanation of the problem and a fix for all modern Browsers and IE&gt;8.</p>
<p>If the last line length of the blockquote text was near the right border, the quotation mark was overlapping the text.<br />
<a href="http://www.andre-abt.com/wp-content/uploads/2012/08/blockquote_problem.png"><img class="size-full wp-image-1938 alignnone" title="blockquote_problem" src="http://www.andre-abt.com/wp-content/uploads/2012/08/blockquote_problem.png" alt="" width="238" height="98" /></a></p>
<p>No Problem with shorter Texts.<br />
<a href="http://www.andre-abt.com/wp-content/uploads/2012/08/blockquote_noproblem.png"><img class="size-full wp-image-1939 alignnone" title="blockquote_noproblem" src="http://www.andre-abt.com/wp-content/uploads/2012/08/blockquote_noproblem.png" alt="" width="239" height="116" /></a></p>
<p>Let&#8217;s have a look at the CSS after the fix:</p>
<p></p><pre class="crayon-plain-tag">blockquote {
    position: relative; /* That's the interesting part, &amp;quot;::after&amp;quot; elements seems to have a child/parent with their predcessor */
    padding: 8px 20px 5px 32px;
    width: 173px; /*225*/
}

blockquote::after {
    position: absolute; /* set the position here does the trick */
    content: &amp;quot;\201D&amp;quot;;
    bottom: 5px;
    font-weight: bold;
    line-height: 0;
    vertical-align: bottom;
    color: #01428C;
 }</pre><p></p>
<p>Problem solved:<br />
<a href="http://www.andre-abt.com/wp-content/uploads/2012/08/blockquote_solved2.png"><img class="alignnone size-full wp-image-1946" title="blockquote_solved" src="http://www.andre-abt.com/wp-content/uploads/2012/08/blockquote_solved2.png" alt="" width="249" height="116" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.andre-abt.com/2012/08/09/tame-styled-blockquote-quotation-icons-positioning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debug SimpleXML objects with Twig</title>
		<link>http://www.andre-abt.com/2012/04/12/debug-simplexml-objects-with-twig/</link>
		<comments>http://www.andre-abt.com/2012/04/12/debug-simplexml-objects-with-twig/#comments</comments>
		<pubDate>Thu, 12 Apr 2012 16:01:34 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.andre-abt.com/?p=1906</guid>
		<description><![CDATA[Using SimpleXML objects in Twig templates sucks.. especially with older Twig versions. To at least debug them, I&#8217;ve added a custom twig filter with the following method: [crayon-519a323a12875/] The &#8220;magic&#8221; happens on line 3, the second attribute set to &#8220;true&#8221;, converts returned objects into associative arrays.]]></description>
				<content:encoded><![CDATA[<p>Using SimpleXML objects in Twig templates sucks.. especially with older Twig versions.<br />
To at least debug them, I&#8217;ve added a custom twig filter with the following method:</p>
<p></p><pre class="crayon-plain-tag">public function debugSimpleXml($simpleXmlObject) {
    $json = json_encode($simpleXmlObject);
    $array = json_decode($json, true);
    echo '&lt;pre&gt;';
    var_dump($array);
    echo '&lt;/pre&gt;';
}</pre><p> </p>
<p>The &#8220;magic&#8221; happens on line 3, the second attribute set to &#8220;true&#8221;, converts returned objects into associative arrays.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andre-abt.com/2012/04/12/debug-simplexml-objects-with-twig/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JHS Little Black Buffer Review</title>
		<link>http://www.andre-abt.com/2011/12/12/jhs-little-black-buffer-review/</link>
		<comments>http://www.andre-abt.com/2011/12/12/jhs-little-black-buffer-review/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 11:48:17 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Guitar]]></category>
		<category><![CDATA[Music]]></category>

		<guid isPermaLink="false">http://www.andre-abt.com/?p=1884</guid>
		<description><![CDATA[I finally received my ordered LBB (Little Black Buffer) from JHS Pedals and was able to try it out over the weekend. I&#8217;ve added the Buffer to the beginning of my Pedal Chain which consists around ten different Overdrives, Delays and stuff. Most of the Pedals are True Bypass &#8211; thats a good thing you [...]]]></description>
				<content:encoded><![CDATA[<p>I finally received my ordered LBB (Little Black Buffer) from JHS Pedals and was able to try it out over the weekend. I&#8217;ve added the Buffer to the beginning of my Pedal Chain which consists around ten different Overdrives, Delays and stuff. Most of the Pedals are True Bypass &#8211; thats a good thing you may think, but actually that causes a big treble loss.</p>
<p><img class="size-thumbnail wp-image-1896 alignright" title="pedalboard" src="http://www.andre-abt.com/wp-content/uploads/2011/12/pedalboard-284x150.jpg" alt="" width="284" height="150" /></p>
<p>I&#8217;ve compared the signal from the guitar running through a 3m cable direct into the Amp, and the signal running through the complete setup with all pedals and the buffer &#8211; and guess what?  The Sound is 100% identical.</p>
<p>I can&#8217;t recommend this Buffer Pedal high enough!</p>
<p><a title="JHS Little Black Buffer" href="http://www.jhspedals.com/jhspedals/JHS_Little_Black_Buffer.html" target="_blank">http://www.jhspedals.com/jhspedals/JHS_Little_Black_Buffer.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.andre-abt.com/2011/12/12/jhs-little-black-buffer-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LiipUrlAutoConverterBundle available on github</title>
		<link>http://www.andre-abt.com/2011/10/26/liipurlautoconverterbundle-available-on-github/</link>
		<comments>http://www.andre-abt.com/2011/10/26/liipurlautoconverterbundle-available-on-github/#comments</comments>
		<pubDate>Wed, 26 Oct 2011 19:23:13 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.andre-abt.com/?p=1866</guid>
		<description><![CDATA[Added a little Twig Extension with a Filter Method  to github. It will convert urls and email addresses in a string to working html links. Nothing super fancy, but as its my first little Symfony2 bundle, its worth a blog post. https://github.com/liip/LiipUrlAutoConverterBundle]]></description>
				<content:encoded><![CDATA[<p>Added a little Twig Extension with a Filter Method  to github. It will convert urls and email addresses in a string to working html links. Nothing super fancy, but as its my first little Symfony2 bundle, its worth a blog post.</p>
<p><a title="LiipUrlAutoConverterBundle" href="https://github.com/liip/LiipUrlAutoConverterBundle" target="_blank">https://github.com/liip/LiipUrlAutoConverterBundle</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.andre-abt.com/2011/10/26/liipurlautoconverterbundle-available-on-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Form Protection CSRF/XSS Nightmare today&#8230;</title>
		<link>http://www.andre-abt.com/2011/07/25/form-protection-csrfxss-nightmare/</link>
		<comments>http://www.andre-abt.com/2011/07/25/form-protection-csrfxss-nightmare/#comments</comments>
		<pubDate>Mon, 25 Jul 2011 12:55:37 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Geek Stuff]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[csrf]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[token]]></category>
		<category><![CDATA[xss]]></category>

		<guid isPermaLink="false">http://www.andre-abt.com/?p=1786</guid>
		<description><![CDATA[If you have a PHP Problem, do you cross check it in another browser usually? Well I&#8217;ll do in the future.. This morning I implemented a XSS/CSRF protection into a newsletter subscription form. Usually I do it with a token, that will be generated during the frontend page load, and will be written in the [...]]]></description>
				<content:encoded><![CDATA[<p>If you have a PHP Problem, do you cross check it in another browser usually? Well I&#8217;ll do in the future.. <img src='http://www.andre-abt.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>This morning I implemented a XSS/CSRF protection into a newsletter subscription form. Usually I do it with a token, that will be generated during the frontend page load, and will be written in the php session. The form content is submitted via AJAX to a PHP script, that handles the complete newsletter opt-in process. This script cross-checks the current token in the session with the submitted one.</p>
<p>So, inside the form page, there is something like this:</p>
<p></p><pre class="crayon-plain-tag">&lt;?php
    $token = uniqid('token_newsletter_', true);
    $_SESSION['newsletter_token'] = $token;
?&gt;
&lt;input type=&quot;hidden&quot; id=&quot;newsletter_token&quot;&nbsp;value=&quot;&lt;?=$token?&gt;&quot;/&gt;;</pre><p></p>
<p>The security check is in the processing php script:</p>
<p></p><pre class="crayon-plain-tag">//$data is the via AJAX submited, json decoded data
if ($data['token'] !== $_SESSION['newsletter_token']) {
    die();
}</pre><p></p>
<p>So far so good. But it was not working &#8211; so I started to debug. On the form page I checked the values of the generated token and the one in the session:</p>
<p><strong>Session-Token: token_newsletter_4e2d5dd92732e4.19727735</p>
<p>Token: token_newsletter_4e2d5dd92732e4.19727735</strong></p>
<p>Of course identical, so I checked the vars in the processing script:</p>
<p><strong>string(46) &#8220;data: token_newsletter_4e2d5dd92732e4.19727735&#8243;<br />
string(49) &#8220;session: token_newsletter_4e2d5eab38b752.61124898&#8243;</strong></p>
<p>different! :-S &#8211; now how could that be?</p>
<p>First instant thought: &#8220;There must be a Problem with the AJAX call, so there is a different session generated or something&#8221;.. short after that I realized, that the server handles &#8220;normal&#8221; and ajax browser calls the same way. So they share the same PHP Session.</p>
<p>After a tipp from a friend I decided to write a quick debug script that writes debug output into a text file. This way its possible to see if the writer is called more than once.</p>
<p></p><pre class="crayon-plain-tag">$token = uniqid('token_newsletter_', true);
$_SESSION['newsletter_token'] = $token;
//debug write to text file
$file = 'debug.txt';
$fh = fopen($file, 'a');
$stringData = $token.PHP_EOL;
fwrite($fh, $stringData);
fclose($fh);</pre><p></p>
<p>Now on every page reload, two new entries where written in the file, with different tokens of course! So my next idea was, there must be a problem with the CMS so the form code gets executed twice. Step, by step I broke it down, at the end I putted the code above right on top to the index.php and now what? Still two entries in the text file where generated..</p>
<p>I am using the Chrome Browser for Web Development usually, so I tried the same thing with Firefox -&gt; badam only one entry!</p>
<p>&#8220;No way!&#8221; &#8211; so I disabled all Chrome addons but still the same problem.</p>
<p>After some googling I found this:</p>
<p><a title="bug" href="http://code.google.com/p/chromium/issues/detail?id=39402" target="_blank">http://code.google.com/p/chromium/issues/detail?id=39402</a></p>
<p>Know what? Chrome is sending a request for a favicon on every page reload. As, is likely, you aren&#8217;t sending a favicon back, it requests one after every legitimate request.</p>
<p>This causes this weird problem.. in the background the favicon call seems to trigger a new execution of the php script, so a new token will be generated and stored into the session, the html output of this will not be transfered back to the client.. Very annoying but interesting problem &#8211; 3 hours waste so far.</p>
<p>But the story goes on, after a quick check in all other browsers I realized, Safari has the same problem.. argh!<br />
What now? Both browsers seems to do a second request 1-2 seconds after the page load. The request dosen&#8217;t show up in the Chrome Networking Monitor. So I just created a favicon.ico file on: <a href="http://www.favicon.cc/">http://www.favicon.cc/</a>. -&gt; Problem gone in both Browsers! Aha!</p>
<p>I realized that probably this second favicon request will be translated from the .htaccess file (we have url rewriting in our CMS) and redirected to the home.php script. The Server parses the PHP, then he responds with the html output. Because this is no favicon, both browsers ignore the response. But at this time, a new token was allready generated on the server and saved into the session&#8230;</p>
<p>After some more tests I got to the real source of the problem in the .htaccess file. &#8220;ErrorDocument 404 /error &#8221; &#8211; we use a custom page of our cms as 404 Error Document, so if the favicon is not found the page from the cms will be rendered and returned.. fewwww&#8230; what a way to start the week. But &#8211; I learned a lot! <img src='http://www.andre-abt.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Now the best solution for this seems to just allways use a favicon. Not sure if there would be a fix to exclude the favicon from the error redirect &#8211; if you know something, please let me know!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.andre-abt.com/2011/07/25/form-protection-csrfxss-nightmare/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Browser based classic Sierra Adventure Games</title>
		<link>http://www.andre-abt.com/2010/10/24/browser-based-classic-sierra-adventure-games/</link>
		<comments>http://www.andre-abt.com/2010/10/24/browser-based-classic-sierra-adventure-games/#comments</comments>
		<pubDate>Sun, 24 Oct 2010 21:19:04 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Geek Stuff]]></category>
		<category><![CDATA[Inspiration]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.andre-abt.com/?p=1688</guid>
		<description><![CDATA[If you are like me, you love those old Sierra PC Games like Space Quest, Larry, Kings Quest and so on. Martin Kool, a crazy dutch guy ported some of the games for your browser completely based on XHTML/CSS and JS. At the moment he work  on a iPad port of Space Quest. check this [...]]]></description>
				<content:encoded><![CDATA[<p>If you are like me, you love those old Sierra PC Games like Space Quest, Larry, Kings Quest and so on.<br />
Martin Kool, a crazy dutch guy ported some of the games for your browser completely based on XHTML/CSS and JS. At the moment he work  on a iPad port of Space Quest.</p>
<p>check this out: <a title="sarien" href="http://sarien.net" target="_blank">http://sarien.net</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.andre-abt.com/2010/10/24/browser-based-classic-sierra-adventure-games/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Plasma Effect with Processing</title>
		<link>http://www.andre-abt.com/2010/10/08/plasma-effect-with-processing/</link>
		<comments>http://www.andre-abt.com/2010/10/08/plasma-effect-with-processing/#comments</comments>
		<pubDate>Fri, 08 Oct 2010 08:13:23 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Geek Stuff]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Amiga]]></category>
		<category><![CDATA[C-64]]></category>
		<category><![CDATA[Demo]]></category>
		<category><![CDATA[Plasma]]></category>
		<category><![CDATA[Processing]]></category>

		<guid isPermaLink="false">http://www.andre-abt.com/?p=1647</guid>
		<description><![CDATA[I allways wanted to code &#8220;Plasma&#8221;, a psychedelic color palette effect. A FX seen a lot in Demos of the good old C-64 and Amiga days. I didn&#8217;t found any good example on the net, but a friend of mine gave me some hints and so I did it. The example should be easy to [...]]]></description>
				<content:encoded><![CDATA[<p>I allways wanted to code &#8220;Plasma&#8221;, a psychedelic color palette effect. A FX seen a lot in Demos of the good old C-64 and Amiga days. I didn&#8217;t found any good example on the net, but a friend of mine gave me some hints and so I did it. The example should be easy to understand, if you have any questions &#8211; drop me a line! The source code is hosted on GitHub: <a title="Plasma" href="https://github.com/monobasic/Plasma-for-Processing" target="_blank">https://github.com/monobasic/Plasma-for-Processing</a></p>
<p>Here we go with the code:</p>
<p></p><pre class="crayon-plain-tag">color palette [] = new color [256];  // array with 256 colors

void setup() {
  size(250, 250, P2D);
  background(51);
  noStroke();
  //smooth();

  // create color palette
  int i, r, g, b;
  // between 0..100 fade black to red
  for (i = 0; i &amp;lt; 100; i++)
  {
    r = i * 255 / 100;
    g = 0;
    b = 0;
    palette[i] = color (r, g, b);
  }
  // between 100..150 fade red to yellow
  for ( ; i &amp;lt; 150; i++)
  {
    r = 255;
    g = (i-100) * 255 / 50;
    b = 0;
    palette[i] = color (r, g, b);
  }
  // between 150..255 fade yellow to blue
  for ( ; i &amp;lt;= 255; i++)
  {
    r = 255 - ((i - 150) * 255 / 106);
    g = 255 - ((i - 150) * 255 / 106);
    b = (i - 150) * 255 / 106;
    palette[i] = color (r, g, b);
  }
}

float deg;
float rad;
color currentColor;
int currentPixel;
float fColor;
int time;
float value;

void draw() {

  loadPixels();

  for(int y=0;y&amp;lt;height;y++) {
    //draw line
    for(int x=0;x&amp;lt;width;x++) {
      // 4 different sinus functions modulating
      fColor = ((sin (x/18.0 + time/99.0) + cos (y/39.0 + time/30.0))
               + sin (x/39.0 - time/40.0) + cos (y/15.0 - time/40.0))
               / 4;
      /* variante
      fColor = ((sin (x/15.0 + time/99.0) * cos (y/39.0 + time/30.0))
               + sin (x/39.0 - time/40.0) * cos (y/15.0 - time/40.0)) / 4;
      */

      // normalize to 0..255.
      fColor = ((fColor + 1) / 2) * 255;

      // get color from palette
      currentColor = palette[int (fColor)];

      // colorize current pixel
      currentPixel = (y * width)  + x;
      pixels[currentPixel] = currentColor;
    }
  }
  updatePixels();
  time++;
}</pre><p></p>
<p>Related Links:<br />
<a href="http://en.wikipedia.org/wiki/Demo_effect">http://processing.org/<br />
</a><a href="http://" target="_blank">http://en.wikipedia.org/wiki/Demo_effect</a><br />
<a href="http://en.wikipedia.org/wiki/Plasma_effect" target="_blank">http://en.wikipedia.org/wiki/Plasma_effect</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.andre-abt.com/2010/10/08/plasma-effect-with-processing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The even better way to debug web sites and applications in IE 6-9</title>
		<link>http://www.andre-abt.com/2010/07/28/the-even-better-way-to-debug-web-sites-and-applications-in-ie-6-9/</link>
		<comments>http://www.andre-abt.com/2010/07/28/the-even-better-way-to-debug-web-sites-and-applications-in-ie-6-9/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 17:43:32 +0000</pubDate>
		<dc:creator>André</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.andre-abt.com/?p=1387</guid>
		<description><![CDATA[IETester is a free WebBrowser that allows you to have the rendering and javascript engines ofIE9 preview, IE8, IE7 IE 6 and IE5.5 on Windows 7, Vista and XP, as well as the installed IE in the same process. You can extend it with &#8220;DebugBar&#8221; from the same guys &#8211; this way its finally possible to have something like FireBug for IE6. I [...]]]></description>
				<content:encoded><![CDATA[<p>IETester is a free WebBrowser that allows you to have the rendering and javascript engines of<strong>IE9 preview, IE8, IE7 IE 6 and IE5.5 on Windows 7, Vista and XP</strong>, as well as the installed IE in the same process. You can extend it with &#8220;DebugBar&#8221; from the same guys &#8211; this way its finally possible to have something like FireBug for IE6. I use it every day and it rocks.</p>
<p><a href="http://www.my-debugbar.com/wiki/IETester/HomePage" target="_blank">http://www.my-debugbar.com/wiki/IETester/HomePage</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.andre-abt.com/2010/07/28/the-even-better-way-to-debug-web-sites-and-applications-in-ie-6-9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
