<?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>Blog::Log &#187; web</title>
	<atom:link href="http://www.stpe.se/category/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stpe.se</link>
	<description>Not a blog, more a log.</description>
	<lastBuildDate>Wed, 02 Jun 2010 13:01:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Developing Large-Scale JavaScript Web Sites &#8211; SWDC2010 slides</title>
		<link>http://www.stpe.se/2010/06/developing-large-scale-javascript-websites/</link>
		<comments>http://www.stpe.se/2010/06/developing-large-scale-javascript-websites/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 12:46:03 +0000</pubDate>
		<dc:creator>stefan</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[presentation]]></category>
		<category><![CDATA[swdc]]></category>

		<guid isPermaLink="false">http://www.stpe.se/?p=203</guid>
		<description><![CDATA[Being very humbled to be part of the star struck lineup at The Scandinavian Web Developer Conference 2010 I did a talk about Developing Large-Scale JavaScript Web Sites (slides available here as PDF). The presentation is basically a quick high-level overview of some of the main points I&#8217;ve encountered after several workshops at different clients [...]]]></description>
			<content:encoded><![CDATA[<p>Being very humbled to be part of the star struck lineup at <a href="http://www.swdc-central.com">The Scandinavian Web Developer Conference 2010</a> I did a talk about <i>Developing Large-Scale JavaScript Web Sites</i> (slides <a href="http://www.stpe.se/presentations/DevelopingLargeScaleJavaScriptWebSites-SWDC2010.pdf">available here as PDF</a>).</p>
<p>The presentation is basically a quick high-level overview of some of the main points I&#8217;ve encountered after several workshops at different clients wanting to take the step from a legacy server centric web site architecture to a modern rich client side implementation.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stpe.se/2010/06/developing-large-scale-javascript-websites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ajax and REST architecture &#8211; Optimera STHLM slides</title>
		<link>http://www.stpe.se/2010/06/ajax-rest-architecture-slides/</link>
		<comments>http://www.stpe.se/2010/06/ajax-rest-architecture-slides/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 11:56:23 +0000</pubDate>
		<dc:creator>stefan</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[presentation]]></category>

		<guid isPermaLink="false">http://www.stpe.se/?p=199</guid>
		<description><![CDATA[I did a presentation at Optimera STHLM entitled Faster websites with AJAX and REST architecture. The talk are more on an architecture level, rather than about implementation details. Slides are available as PDF here (this is an english version of what was presented). The demo I did of the Friendly Iframe ad-loading optimization by Tobias [...]]]></description>
			<content:encoded><![CDATA[<p>I did a presentation at <a href="http://www.internetdagarna.se/pages/seminarier/optimera-sthlm">Optimera STHLM</a> entitled <i>Faster websites with AJAX and REST architecture</i>. The talk are more on an architecture level, rather than about implementation details.</p>
<p>Slides are available as <a href="http://www.stpe.se/presentations/AJAXRESTArchitecture-OptimeraSTHLM.pdf">PDF here</a> (this is an english version of what was presented).</p>
<p>The demo I did of the Friendly Iframe ad-loading optimization by Tobias Järlund at Aftonbladet is available at the <a href="http://blogg.aftonbladet.se/dev/2010/06/aftonbladet-pa-optimera-sthlm">Aftonbladet dev blog</a> (swedish).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stpe.se/2010/06/ajax-rest-architecture-slides/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Optimera STHLM</title>
		<link>http://www.stpe.se/2010/05/optimera-sthlm/</link>
		<comments>http://www.stpe.se/2010/05/optimera-sthlm/#comments</comments>
		<pubDate>Wed, 12 May 2010 12:22:57 +0000</pubDate>
		<dc:creator>stefan</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[presentation]]></category>

		<guid isPermaLink="false">http://www.stpe.se/?p=197</guid>
		<description><![CDATA[I&#8217;m speaking at Optimera STHLM (that&#8217;s Optimize Stockholm) 31st of May about modern web architecture using JavaScript, Ajax and RESTful web services and what that means to both frontend and backend.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m speaking at <a href="http://www.internetdagarna.se/pages/seminarier/optimera-sthlm">Optimera STHLM</a> (that&#8217;s Optimize Stockholm) 31st of May about modern web architecture using JavaScript, Ajax and RESTful web services and what that means to both frontend and backend.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stpe.se/2010/05/optimera-sthlm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introduction to Google Maps API</title>
		<link>http://www.stpe.se/2010/04/introduction-to-google-maps-api/</link>
		<comments>http://www.stpe.se/2010/04/introduction-to-google-maps-api/#comments</comments>
		<pubDate>Thu, 08 Apr 2010 21:22:01 +0000</pubDate>
		<dc:creator>stefan</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[google maps]]></category>
		<category><![CDATA[gtug]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.stpe.se/?p=191</guid>
		<description><![CDATA[I just did a short talk at the Google Technology User Group meetup in Stockholm this evening about the Google Maps API. The purpose of the talk was to give a quick introduction on how to get started as well as show off some of the features. I wanted to emphasize how easy, using only [...]]]></description>
			<content:encoded><![CDATA[<p>I just did a short talk at the <a href="http://sites.google.com/site/stockholmgtug/">Google Technology User Group</a> meetup in Stockholm this evening about the Google Maps API. The purpose of the talk was to give a quick introduction on how to get started as well as show off some of the features. I wanted to emphasize how easy, using only a few lines of code, it is to leverage power-full features like geocoding, directions and streetview in your own implementation.</p>
<p>Here is the <a href="http://stpe.se/javascript/gmaps/gtug-april-gmaps.pdf">presentation as pdf</a> and the <a href="http://stpe.se/javascript/gmaps/">implementation examples</a> I demonstrated.</p>
<p>It was great fun as always, with lots of people (<a href="http://twitter.com/psvensson/status/11842283528">apx 90</a>). Thanks for having me!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stpe.se/2010/04/introduction-to-google-maps-api/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Get selected value of radio button using YUI 3</title>
		<link>http://www.stpe.se/2009/12/selected-value-radio-button-yui-javascript/</link>
		<comments>http://www.stpe.se/2009/12/selected-value-radio-button-yui-javascript/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 10:31:26 +0000</pubDate>
		<dc:creator>stefan</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[yui]]></category>

		<guid isPermaLink="false">http://www.stpe.se/?p=170</guid>
		<description><![CDATA[Getting the value of a the currently selected radio button may be done in a couple of ways. This is one approach using YUI 3. Here is the HTML: &#60;input type=&#34;radio&#34; name=&#34;myoptions&#34; value=&#34;one&#34;&#62; First &#60;input type=&#34;radio&#34; name=&#34;myoptions&#34; value=&#34;two&#34;&#62; Second &#60;input type=&#34;radio&#34; name=&#34;myoptions&#34; value=&#34;three&#34;&#62; Third Get the currently selected value using only one line of code: [...]]]></description>
			<content:encoded><![CDATA[<p>Getting the value of a the currently selected radio button may be done in a couple of ways. This is one approach using <a href="http://developer.yahoo.com/yui/3/">YUI 3</a>.</p>
<p>Here is the HTML:</p>
<pre class="brush: xml;">
&lt;input type=&quot;radio&quot; name=&quot;myoptions&quot; value=&quot;one&quot;&gt; First
&lt;input type=&quot;radio&quot; name=&quot;myoptions&quot; value=&quot;two&quot;&gt; Second
&lt;input type=&quot;radio&quot; name=&quot;myoptions&quot; value=&quot;three&quot;&gt; Third
</pre>
<p>Get the currently selected value using only one line of code:</p>
<pre class="brush: jscript;">
var value = Y.one('[name=myoptions]:checked').get('value');
</pre>
<p>Unfortunately, this does not work in Internet Explorer, so another (not as tight) approach is:</p>
<pre class="brush: jscript;">
function getRadioSelectedValue(selector) {
    var tmpValue= false;
    Y.all(selector).each(function(node) {
        if (node.get('checked') tmpValue = node.get('value');
    });
    return tmpValue;
}
var value = getRadioSelectedValue('.myRadioGroupClass'); // this assumes you've set appropriate class to radio elements
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.stpe.se/2009/12/selected-value-radio-button-yui-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Custom Modules in YUI 3</title>
		<link>http://www.stpe.se/2009/11/custom-modules-in-yui-3/</link>
		<comments>http://www.stpe.se/2009/11/custom-modules-in-yui-3/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 21:21:45 +0000</pubDate>
		<dc:creator>stefan</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[yui]]></category>

		<guid isPermaLink="false">http://www.stpe.se/?p=163</guid>
		<description><![CDATA[YUI 3 uses modules to group functionality and to only load what is used. This post describes how to create custom modules. The typical way modules are used is within the use() statement: YUI().use('node', 'event', function(Y) { // your stuff here }); In the above example the modules node and event are loaded. Let&#8217;s see [...]]]></description>
			<content:encoded><![CDATA[<p>YUI 3 uses modules to group functionality and to only load what is used. This post describes how to create custom modules.</p>
<p>The typical way modules are used is within the use() statement:</p>
<pre class="brush: jscript;">
YUI().use('node', 'event', function(Y) {
    // your stuff here
});
</pre>
<p>In the above example the modules <strong>node</strong> and <strong>event</strong> are loaded. Let&#8217;s see how custom modules may be included in the same way.</p>
<p>To define a new module the add() statement is used (note that it is a class and not instance method of the YUI object):</p>
<pre class="brush: jscript;">
YUI.add('my_module', function(Y) {
    Y.myFunction = function() {
        var privateFunc = function() {
            // ...
        };

        return {
            publicFunc: function() {
                // ...
            }
        }
    }();
}, '0.0.1', { requires: ['node'] });
</pre>
<p>A common way to share functionality among different YUI instances is to use the YUI namespace when assigning the function. If you do not recognize the structure of the above function definition you may find out more by reading about the <a href="http://yuiblog.com/blog/2007/06/12/module-pattern/">module pattern</a>.</p>
<p>If the file containing the custom module code is loaded, the custom module may be used in any use() statements as normal YUI modules, i.e. use(&#8216;my_module&#8217;, &#8230;).</p>
<p>To leverage the power of the <a href="http://developer.yahoo.com/yui/3/examples/yui/yui-loader-ext.html">YUI loader</a> to dynamically load the custom module a configuration object may be created.</p>
<pre class="brush: jscript;">
YUI({
    modules: {
       'my_module': {
           fullpath: &amp;quot;http://mydomain.com/js/my_module.js&amp;quot;,
           requires: ['node']
       }
    }
}).use('node', 'my_module, function(Y) {
    // access functionality of custom module
    Y.myFunction.publicFunc();
});
</pre>
<p>One thing to note is that YUI currently only makes one request to fetch dependencies. That is why the module&#8217;s <i>requires</i> array must be specified in the configuration object as well, in addition to what is in the last parameter of the add() statement.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stpe.se/2009/11/custom-modules-in-yui-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Instance and class based plugins in YUI 3</title>
		<link>http://www.stpe.se/2009/11/instance-and-class-plugins-in-yui3/</link>
		<comments>http://www.stpe.se/2009/11/instance-and-class-plugins-in-yui3/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 04:56:59 +0000</pubDate>
		<dc:creator>stefan</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[yui]]></category>

		<guid isPermaLink="false">http://www.stpe.se/?p=155</guid>
		<description><![CDATA[Using plugins in YUI 3 is a way to add functionality to existing objects in YUI (very much like you would use prototype to augment a function to a normal JavaScript object). Objects in YUI all derive from Y.Base. Note that this post is about YUI 3 and not YUI 2. However, the current YUI [...]]]></description>
			<content:encoded><![CDATA[<p>Using plugins in YUI 3 is a  way to add functionality to existing objects in YUI (very much like you would use prototype to augment a function to a normal JavaScript object). Objects in YUI all derive from <code>Y.Base</code>. </p>
<p>Note that this post is about YUI 3 and not YUI 2.</p>
<p>However, the <a href="http://developer.yahoo.com/yui/3/plugin/">current YUI 3 documentation</a> does really only get into how to add a plugin to a current instance. What about adding functionality to the class level so all instances of the same type of objects automatically get it?</p>
<p>First an example of how a simple plugin may look like:</p>
<pre class="brush: jscript;">
NodePlugin = function(config) {
    this._node = config.host;
}

NodePlugin.NS = 'vis';
NodePlugin.NAME = 'NodeVisibiltyPlugin';

NodePlugin.prototype = {
    show: function() {
        this._node.setStyle('display', 'block');
        return this_node;
    },

    hide: function() {
        this._node.setStyle('display', 'none');
        return this_node;
    }
};
</pre>
<p>What this plugin does it to add <code>hide()</code> and <code>show()</code> functions to the <code>vis</code> namespace (as specified in the code) of <code>Y.Node</code>.</p>
<p>This plugin would typically be used like this:</p>
<pre class="brush: jscript;">
var node = Y.one('#myElement');
node.plug(NodePlugin); // add plugin functionality
node.vis.hide();
</pre>
<p>If you would like to use the plugin functionality for all node objects it would be somewhat tedious to invoke <code>plug()</code> for each and every instance. The way to get around this, which is not really documented except in the <a href="http://developer.yahoo.com/yui/3/api/Plugin.Host.html#method_Plugin.Host.plug">API reference</a>, is to use the static method <code>Y.Plugin.Host.plug</code>.</p>
<pre class="brush: jscript;">
Y.Plugin.Host.plug(Y.Node, NodePlugin); // plug once ...

var node = Y.one('#myElement');
node.vis.hide(); // ... use anywhere
</pre>
<p>Now any new instances of <code>Y.node</code> have access to the plugin methods through the specified namespace. I also discovered that in order for this to work the static <code>NAME</code> property must be defined in the plugin object.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stpe.se/2009/11/instance-and-class-plugins-in-yui3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Progressive enhancements with JavaScript and CSS</title>
		<link>http://www.stpe.se/2009/10/progressive-enhancements-with-javascript-and-css/</link>
		<comments>http://www.stpe.se/2009/10/progressive-enhancements-with-javascript-and-css/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 19:55:05 +0000</pubDate>
		<dc:creator>stefan</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[progressive enhancements]]></category>

		<guid isPermaLink="false">http://www.stpe.se/?p=133</guid>
		<description><![CDATA[It is clear that IE6 is not going away just yet, at least not for mainstream websites targeting a large (and non-tech) audience. Quite some time and effort is put into making design and functionality work in IE6 which otherwise works perfectly well in more modern browsers. This is inefficient, but just because IE6 support [...]]]></description>
			<content:encoded><![CDATA[<p>It is clear that IE6 is not going away just yet, at least not for mainstream websites targeting a large (and non-tech) audience. Quite some time and effort is put into making design and functionality work in IE6 which otherwise works perfectly well in more modern browsers. This is inefficient, but just because IE6 support cannot be dropped does not mean the cause is lost. The key is to not think black and white, instead think in terms of <em>progressive enhancements</em>.</p>
<p>The fundamental concept of progressive enhancements are that anyone may use the functionality, but a more enhanced version is available for those with more advanced browsers.</p>
<p>Having a complex feature with pixel perfect appearance and functionality in all browsers usually means that you implement it on standard compliant browsers, and then provide workarounds to make it work in Internet Explorer (usually a significant amount of work). The key to reduce this waste of time is not to skip IE6 entirely (which may not be an option), but to let go of having everything exactly the same in all browser. Instead, provide the basic functionality to IE6 but add the shinyness and bling to newer browsers.</p>
<h3>The old approach</h3>
<p>About a year ago I did a JavaScript map implementation (similar to Google Maps) and it had an info box popup that could contain additional information. The original requirements were that it should have rounded corners and a pointer that depending on position could point in four directions (flipping when the map moved). In addition the dimensions should automatically size to the content unless a fixed width and/or height were set.</p>
<div id="attachment_136" class="wp-caption aligncenter" style="width: 250px"><img class="size-full wp-image-136" title="Old InfoBox implementation" src="http://www.stpe.se/wp-content/uploads/2009/10/infobox-old.png" alt="Old (complex) InfoBox implementation" width="240" height="180" /><p class="wp-caption-text">Old (complex) InfoBox implementation</p></div>
<p>And it should <em>look exactly the same in all browsers</em>. This single line of requirement resulted in the implementation becoming one of the largest and most complex modules in the whole mapping application. Using css sprites for the corners, off-screen rendering to estimate size, lots of IE workarounds and so on&#8230; probably 60% of the development time were spent on compatibility issues.</p>
<h3>The modern way</h3>
<p>I recently had the opportunity to rewrite the info box implementation, using a much smarter approach. The key was that the basic functionality should work in IE6, but it shouldn&#8217;t necessary look the same.</p>
<p>This resulted in an implementation that was 1/5 of the number of lines of the original, didn&#8217;t require additional images for the corners (reducing number of HTTP requests), no IE hacks and was a lot more flexible.</p>
<p>By using <em>border-radius</em> and <em>box-shadow</em> available in CSS3 the implementation was very simple, and we even got a drop shadow for free.</p>
<div id="attachment_142" class="wp-caption aligncenter" style="width: 270px"><img class="size-full wp-image-142" title="InfoBox in modern browsers" src="http://www.stpe.se/wp-content/uploads/2009/10/infobox-modern.png" alt="InfoBox in modern browsers" width="260" height="180" /><p class="wp-caption-text">InfoBox in modern browsers</p></div>
<p style="text-align: left;">Using an old or non-standard browser like Internet Explorer resulted in the following look.</p>
<p style="text-align: left;">
<div id="attachment_143" class="wp-caption aligncenter" style="width: 250px"><img class="size-full wp-image-143" title="infobox-ie" src="http://www.stpe.se/wp-content/uploads/2009/10/infobox-ie.png" alt="InfoBox in Internet Explorer" width="240" height="180" /><p class="wp-caption-text">InfoBox in Internet Explorer</p></div>
<p>Still functional and useful, but without the extra visual appearance. However, instead the development time was dramatically reduced and the implementation dead easy instead of very complex.</p>
<h3>The challenge</h3>
<p>This is all pretty straightforward, why do it any other way? Usually the challenge is not technical, but rather to communicate this to the stakeholder. Most organizations simply state &#8220;Support IE6+, FF2+, &#8230;&#8221; implicitly resulting in requirements demanding exactly the same functionality pixel by pixel between the supported browsers.</p>
<p>This is where it gets wrong and the challenge is to change it! It is not about being supported or not supported &#8211; it is about to what extent should a browser be supported! IE6 may be supported in a way that the core functionality is useful, but it may look less attractive and some fancy (but non critical) features may be removed.</p>
<p>To what extent each browser should be supported should be a conscious and strategical choice! The benefits are huge with productivity gains, less complex code and faster time-to-market. And it is up to you, as a developer, to communicate this and make it happen!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stpe.se/2009/10/progressive-enhancements-with-javascript-and-css/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Internet Explorer cross-site scripting warning</title>
		<link>http://www.stpe.se/2009/04/internet-explorer-cross-site-scripting-warning/</link>
		<comments>http://www.stpe.se/2009/04/internet-explorer-cross-site-scripting-warning/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 15:08:37 +0000</pubDate>
		<dc:creator>stefan</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[ie]]></category>

		<guid isPermaLink="false">http://www.stpe.se/?p=116</guid>
		<description><![CDATA[I came across the warning &#8220;Internet Explorer has modified this page to help prevent cross-site scripting.&#8221; which is triggered by the IE8 security filter. However, IE gives no clues of why the warning was triggered or what was modified to prevent it. Annoying. To get some more information you must download Microsoft Application Compatibility Toolkit [...]]]></description>
			<content:encoded><![CDATA[<p>I came across the warning &#8220;Internet Explorer has modified this page to help prevent cross-site scripting.&#8221; which is triggered by the IE8 security filter.</p>
<p>However, IE gives no clues of why the warning was triggered or what was modified to prevent it. Annoying.</p>
<p>To get some more information you must download <a href="http://technet.microsoft.com/en-us/library/cc507852.aspx">Microsoft Application Compatibility Toolkit</a> and run the Internet Explorer Compatibility Test Tool.</p>
<p>More information about this particular issue with XSS is <a href="http://msdn.microsoft.com/en-us/library/dd565647(VS.85).aspx">available here</a>.</p>
<p>It is possible to stop this warning from occuring (beside actually fixing the underlying issue) by adding a custom header entry: <code>X-XSS-Protection: 0</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.stpe.se/2009/04/internet-explorer-cross-site-scripting-warning/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
