<?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>uxebu » blog &#187; development</title>
	<atom:link href="http://uxebu.com/tag/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://uxebu.com/blog</link>
	<description></description>
	<lastBuildDate>Thu, 19 Jan 2012 14:53:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>EmbedJS 0.2 and AMD</title>
		<link>http://uxebu.com/blog/2011/10/17/embedjs-0-2-and-amd/</link>
		<comments>http://uxebu.com/blog/2011/10/17/embedjs-0-2-and-amd/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 15:43:16 +0000</pubDate>
		<dc:creator>Jens Arps</dc:creator>
				<category><![CDATA[development tools]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[html5apps]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[embedjs]]></category>

		<guid isPermaLink="false">http://uxebu.com/blog/?p=1843</guid>
		<description><![CDATA[During JSConf.eu, we released EmbedJS 0.2. That release was mainly about a fundamental architectural change: the move to the AMD pattern for our features. Let me explain why we decided to do this, why we think this is a big step forward and what this means for the user. Modules AMD stands for &#8220;Asynchronous Module [...]]]></description>
			<content:encoded><![CDATA[<p>During JSConf.eu, we released EmbedJS 0.2. That release was mainly about a fundamental architectural change: the move to the AMD pattern for our features. Let me explain why we decided to do this, why we think this is a big step forward and what this means for the user.<br />
<span id="more-1843"></span></p>
<h2>Modules</h2>
<p>AMD stands for &#8220;Asynchronous Module Definition&#8221;. So, what are modules? I&#8217;ll quote the definition from the <a href="http://wiki.commonjs.org/wiki/Modules/1.1" target="_blank">CommonJS Module specification</a>, as it describes it very well:</p>
<blockquote><p>This specification addresses how modules should be written in order to be interoperable among a class of module systems that can be both client and server side, secure or insecure, implemented today or supported by future systems with syntax extensions. These modules are offered privacy of their top scope, facility for importing singleton objects from other modules, and exporting their own API.</p></blockquote>
<p>So, modules are isolated parts of code that live in their own scope and are kind of self-contained. Well, that is pretty much how we see the individual Features in EmbedJS – we made our feature implementations as small as possible and reduced dependencies as much as possible. Many of EmbedJS&#8217; features are also browser-independent, so why not make it possible to use some of the tools in a non-browser environment?</p>
<p>(If you want to learn more on modules and why we need them, I recommend <a href="http://twitter.com/briancavalier" target="_blank">@briancavalier</a>&#8216;s <a href="http://briancavalier.com/presentations/pgh-js-amd-10-2011/" target="_blank">presentation on modules</a>.)</p>
<h2>Features in EmbedJS</h2>
<p>So far, I didn&#8217;t really explain what I mean with &#8220;Features&#8221;, so let me do another quote, this time from the <a href="http://uxebu.github.com/embedjs/" target="_blank">Project Page</a>:</p>
<blockquote><p>EmbedJS uses the concept of features: Functionalities are split up into features, as fine-grained as possible, and each feature might have multiple implementations.</p></blockquote>
<p>Our Features are kinda small and contain only few methods, sometimes even just one. The asyc-promise feature, for example, will get you Promises, and the transport-jsonp feature will get you a method for pull in data via jsonp – and that&#8217;s it.  If multiple methods are contained within one feature, this is because they are too closely related to each other to split them up, like the html-class feature, which contains the <code class="codecolorer text mac-classic"><span class="text">addClass</span></code>, <code class="codecolorer text mac-classic"><span class="text">removeClass</span></code>, <code class="codecolorer text mac-classic"><span class="text">toggleClass</span></code> and <code class="codecolorer text mac-classic"><span class="text">hasClass</span></code> methods.</p>
<h2>AMD vs CommonJS Modules 1.1</h2>
<p>Now that we knew modules were the way to go, there was another, quite important question to solve: There are two common patterns for modules, so which one do we want to apply? One pattern is described in the above mentioned CommonJS Wiki, the other pattern is described in the <a href="https://github.com/amdjs/amdjs-api/wiki/AMD" target="_blank">AMD wiki</a>.</p>
<p>Well, there have been <a href="http://tagneto.blogspot.com/2011/04/on-inventing-js-module-formats-and.html" target="_blank">some</a> <a href="http://unscriptable.com/index.php/2011/09/30/amd-versus-cjs-whats-the-best-format/" target="_blank">blog</a> <a href="http://blog.millermedeiros.com/2011/09/amd-is-better-for-the-web-than-commonjs-modules/" target="_blank">posts</a> lately that compare the pros and cons of each of them, so I don&#8217;t want to repeat all of this – but I&#8217;m hiving a similar tendency towards AMD. Besides this, there was another big reason to go with AMD: Remember, EmbedJS is based on the <a href="http://dojotoolkit.org/" target="_blank">Dojo Toolkit</a>, and it&#8217;s a <a href="http://dojofoundation.org/" target="_blank">Dojo Foundation Project</a> – and we hope that the efforts that went into making EmbedJS might flow back into the Dojo Toolkit one day. And as the Dojo Toolkit uses the AMD approach, the decision was quickly made to do so as well.</p>
<h2>Implications for EmbedJS</h2>
<p>There are several huge benefits for EmbedJS in using the AMD approach. The most noteworthy surely is the ease-of-use for developers. In your code, when you find you want an EmbedJS method, you <a href="http://uxebu.github.com/embedjs/docs/" target="_blank">look up the feature name</a> that provides this method, add it to the require statement and there you go. Man, easy.</p>
<p>A second important thing is that EmbedJS now plays really nice with AMD based projects. In fact, you could see EmbedJS now as a collection of small useful modules, that can be easily integrated – and also easily extended.</p>
<p>The third major benefit is that we can now get rid of all the custom tools we built around EmbedJS – you can load features with any AMD loader (though we use and recommend RequireJS) and build it with any AMD optimizer/builder (we recommend r.js).</p>
<p>Let&#8217;s have an extra word on</p>
<p><strong>Building</strong></p>
<p>It was always possible with EmbedJS to create a custom build that would contain only the features you wanted/needed in your project. But, you had to use our build tool that we created. And learning &amp; using Yet-Another-Build-Tool™ is always… well, let&#8217;s just say it would be cool to avoid it (and, not to forget, so is maintaining it). We did a lot to improve that, we created a GUI that allowed you to just &#8220;click together&#8221; the features you wanted, and we worked on a dynamic loader that would ease development. But still, the situation was far from ideal, and people just ended up going for our ready-made &#8220;kitchensink&#8221; builds that contained <em>all</em> of the features.</p>
<p>Now, we still provide those ready-made builds that contain only the implementations for a given platform (and are stripped of require/define calls), but I really hope that using the AMD approach and using an AMD optimizer to deploy will become the more adopted style.</p>
<h2>Q: Cross-target? A: The Feature Plugin</h2>
<p>One goal of EmbedJS is to allow for easy cross-device development. We got rid of run-time branching but instead went for an approach that held the different implementations for a given feature in separate files, so that one only has to deploy the actually needed code to a given device – and not all the alternate implementations, that sit useless in the device&#8217;s memory and never get used. We needed to achieve that with &#8220;in-house&#8221; means provided by the AMD approach. Lucky us, there&#8217;s the concept of <a href="https://github.com/amdjs/amdjs-api/wiki/Loader-Plugins" target="_blank">loader-plugins</a>, and so I created a <a href="https://github.com/jensarps/AMD-feature" target="_blank">feature-plugin for AMD loaders</a>. The idea is simple yet effective: You create an implementation map that maps a feature name to an implementation, and if there are multiple implementations, you supply tests that tells the plugin which feature to use.</p>
<p>When you&#8217;re ready to deploy, you have two choices: I f you really don&#8217;t know on what target your code is going to end up, you can use the dynamic implementation map containing the tests for the optimizer, and you&#8217;ll get a build that contains all of the available implementations. Then, during runtime, the feature plugin will run the tests and load the specific implementation. But, if you <em>do</em> know what target your code will run on, you provide a specific implementation map that doesn&#8217;t contain tests but directly maps to the according implementations, and you will only have those in your built file.</p>
<h2>Synopsis</h2>
<p>AMD is exactly what we needed to make EmbedJS more what we want it to be – an easy to use JavaScript toolbox that is especially handy for cross-target scenarios such as cross-platform mobile development. So, please don&#8217;t hesitate and check it out on Github, read the project page and check out the examples!</p>
<p>&nbsp;</p>
<p><strong>Resources / Further Reading</strong></p>
<ul>
<li><a href="https://github.com/uxebu/embedjs" target="_blank">EmbedJS on GitHub</a></li>
<li><a href="http://uxebu.github.com/embedjs/" target="_blank">EmbedJS Project Page</a></li>
<li><a href="http://uxebu.github.com/embedjs/docs/" target="_blank">EmbedJS API Docs</a></li>
<li><a href="https://github.com/jensarps/AMD-feature" target="_blank">AMD-Feature plugin</a></li>
<li><a href="https://github.com/amdjs/amdjs-api/wiki" target="_blank">AMD Wiki</a></li>
<li><a href="http://wiki.commonjs.org/wiki/CommonJS" target="_blank">CommonJS Wiki</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://uxebu.com/blog/2011/10/17/embedjs-0-2-and-amd/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Explaining EmbedJS</title>
		<link>http://uxebu.com/blog/2011/01/31/explaining-embedjs/</link>
		<comments>http://uxebu.com/blog/2011/01/31/explaining-embedjs/#comments</comments>
		<pubDate>Mon, 31 Jan 2011 14:02:28 +0000</pubDate>
		<dc:creator>Jens Arps</dc:creator>
				<category><![CDATA[development tools]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[frontend engineering]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[uxebu]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[embedjs]]></category>
		<category><![CDATA[memory usage]]></category>
		<category><![CDATA[optimize]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://uxebu.com/blog/?p=1366</guid>
		<description><![CDATA[Last week, we tagged the current state of EmbedJS 0.1. This is a large step for us, and something we have been waiting for and wanting to do for a long time. And with doing so, the need arises to answer a lot of questions – and we better start sooner than later. So, here [...]]]></description>
			<content:encoded><![CDATA[<p>Last week, we tagged the current state of EmbedJS 0.1. This is a large step for us, and something we have been waiting for and wanting to do for a long time. And with doing so, the need arises to answer a lot of questions – and we better start sooner than later. So, here it is, the first part of „Explaining EmbedJS“.</p>
<h2>What is it?</h2>
<p>It‘s a JavaScript Toolkit, especially aimed at embedded devices. Embedded devices, that is phones, tablet devices, TVs, car dashboards and the like. Devices that are capable of running JavaScript. We are sure that this list is going to grow over time – and will hopefully one day also include devices like your fridge. EmbedJS is based on the Dojo Toolkit.<br />
<span id="more-1366"></span></p>
<h2>Why?</h2>
<p>Because the toolkits and frameworks that exist focus on desktop browsers and therefore have a different approach – an approach we didn‘t find that suitable for embedded/mobile development. And the JS frameworks that target mobile devices are flawed, too: either they target only a specific device or platform, or they provide far more than we do need and want.</p>
<p>What we wanted was a toolkit that offered a unified API across different platforms, but with the best implementation that was available for each platform. And we didn‘t want to ship code that implemented a certain feature for, say, an old Blackberry device to an iPhone. Plus, we wanted that API to be small – enough to assist us in our daily work, but not that bloated that we would ship code to a phone that we wouldn‘t need in most of our projects.</p>
<h2>The Dojo Toolkit</h2>
<p>We at uxebu have a strong affinity to the <a href="http://dojotoolkit.org/" target="_blank">Dojo Toolkit</a> – most of us are committers – for a good reason: we believe that it has done many things right, and that it has an excellent code quality. Thus, finding a starting point for our venture to what was later to be EmbedJS was pretty easy: It was the very core of the Dojo Toolkit, dojo._base.</p>
<p>We examined the code and split it into its smallest parts (features, how we call them in EmbedJS). After having the features all nicely separated, we could look for the best implementation for each of the platforms we wanted to support, and put it into a separate file. Then we optimized our code, tweaking here and there, but also using the code from dojo._base as it was, because it already was the best implementation.</p>
<p>And we needed to find means to put all these tiny parts together again, respecting any given dependecies, to create a file that then contained all the feature‘s implementations for a given platform – so the EmbedJS Tools were born, including our highly flexible build system.</p>
<h2>API</h2>
<p>EmbedJS‘ API is a small subset on Dojo‘s API. It provides around 70 methods, from the fields language enhancement (like Array manipulation or JSON), OO (like classes and inheritance), transport (like JSONP or XHR), event system (like connecting to DOM events or methods), DOM manipulation (like style or node creation) and misc things like Promises or pub/sub.</p>
<p>We kept the method signatures intact so that you can import your existing knowledge from working with the Dojo Toolkit to EmbedJS. There are only a few minor changes where we<br />
a) found a new name highly useful, e.g <code class="codecolorer text mac-classic"><span class="text">dojo.io.script.get()</span></code> is <code class="codecolorer text mac-classic"><span class="text">embed.jsonp()</span></code><br />
b) we needed to strip given functionality for the sake of code size.</p>
<p>All methods in EmbedJS are available under the embed namespace as well as under the dojo namespace. I.e. to call the connect method you can use <code class="codecolorer text mac-classic"><span class="text">dojo.connect()</span></code> and <code class="codecolorer text mac-classic"><span class="text">embed.connect()</span></code>.</p>
<p>The full API documentations is <a href="http://embedjs.org/apidocs/dools/app/apidoc/embedjs/" target="_blank">here</a>, though it‘s undergoing some updates right now.</p>
<h2>Summary</h2>
<p>I didn‘t want to dig too deep in the first article on EmbedJS, but I guess you got the point: EmbedJS is a highly optimized Dojo core, and offers you a specialized, optimal build for a given platform. To explain how the build system works, how we manage dependencies, how we separate our features and our implementations and how one can create a project-oriented custom build will need another blog post – but if you are too curious, you are invited to take a look at <a href="https://github.com/uxebu/embedjs" target="_blank">the source code at github</a>; a lot is self-explenatory there. A further source of information is the <a href="http://uxebu.github.com/embedjs/" target="_blank">EmbedJS project page</a>, as well as the <a href="https://github.com/uxebu/embedjs-tools" target="_blank">EmbedJS Tools source</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://uxebu.com/blog/2011/01/31/explaining-embedjs/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Slides from the Ajax in Action</title>
		<link>http://uxebu.com/blog/2008/11/19/slides-from-the-ajax-in-action/</link>
		<comments>http://uxebu.com/blog/2008/11/19/slides-from-the-ajax-in-action/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 13:04:46 +0000</pubDate>
		<dc:creator>wolfram</dc:creator>
				<category><![CDATA[development tools]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[aia2008]]></category>
		<category><![CDATA[ajax in action]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.uxebu.com/?p=90</guid>
		<description><![CDATA[At the Ajax in Action we had four talks. Nikolai spoke about &#8220;Dojo and Adobe AIR&#8221; where he showed on an example how well dojo and AIR integrate. The second was &#8220;RIA/UI development with Dojo&#8221;, where he showed all about how the new layouting widgets in dojo 1.2 can be efficiently used. One talk I [...]]]></description>
			<content:encoded><![CDATA[<p>At the Ajax in Action we had four talks. Nikolai spoke about &#8220;Dojo and Adobe AIR&#8221; where he showed on an example how well dojo and AIR integrate. The second was &#8220;RIA/UI development with Dojo&#8221;, where he showed all about how the new layouting widgets in dojo 1.2 can be efficiently used. One talk I gave was &#8220;Efficient JavaScript Development&#8221;, where I tried to show a couple of tools, strategies, tips and tricks of how to develop JavaScript code efficiently and make it less pain. The second was &#8220;Scaling AJAX apps&#8221;, where I showed some concepts and ways to make your AJAX app fast and scale better.<br />
<span id="more-90"></span></p>
<p>The slides for &#8220;Dojo and Adobe AIR&#8221; can be found here:</p>
<div style="width:425px;text-align:left" class="mhx" id="__ss_767263"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/nonken/dojo-and-adobe-air-presentation?type=powerpoint" title="Dojo and Adobe AIR">Dojo and Adobe AIR</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=airdojo-1227095838606495-8&#038;rel=0&#038;stripped_title=dojo-and-adobe-air-presentation" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=airdojo-1227095838606495-8&#038;rel=0&#038;stripped_title=dojo-and-adobe-air-presentation" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View SlideShare <a style="text-decoration:underline;" href="http://www.slideshare.net/nonken/dojo-and-adobe-air-presentation?type=powerpoint" title="View Dojo and Adobe AIR on SlideShare">presentation</a> or <a style="text-decoration:underline;" href="http://www.slideshare.net/upload?type=powerpoint">Upload</a> your own. (tags: <a style="text-decoration:underline;" href="http://slideshare.net/tag/adobe">adobe</a> <a style="text-decoration:underline;" href="http://slideshare.net/tag/air">air</a>)</div>
</div>
<p>The slides for the &#8220;Building RIAs using the Dojo Toolkit&#8221; can be found here:</p>
<div style="width:425px;text-align:left" class="mhx" id="__ss_767262"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/nonken/riaui-development-with-dojo-presentation?type=powerpoint" title="RIA/UI development with Dojo">RIA/UI development with Dojo</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=riadojo-1227095999072652-9&#038;rel=0&#038;stripped_title=riaui-development-with-dojo-presentation" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=riadojo-1227095999072652-9&#038;rel=0&#038;stripped_title=riaui-development-with-dojo-presentation" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View SlideShare <a style="text-decoration:underline;" href="http://www.slideshare.net/nonken/riaui-development-with-dojo-presentation?type=powerpoint" title="View RIA/UI development with Dojo on SlideShare">presentation</a> or <a style="text-decoration:underline;" href="http://www.slideshare.net/upload?type=powerpoint">Upload</a> your own. (tags: <a style="text-decoration:underline;" href="http://slideshare.net/tag/dojo">dojo</a> <a style="text-decoration:underline;" href="http://slideshare.net/tag/ria">ria</a>)</div>
</div>
<p>The slides for Efficient JavaScript Development can be found here.</p>
<div style="width:425px;text-align:left" class="mhx" id="__ss_710327"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/wolframkriesing/efficient-java-script-development-presentation?type=powerpoint" title="Efficient Java Script Development">Efficient Java Script Development</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=efficient-javascript-development-1225481737770525-9&#038;stripped_title=efficient-java-script-development-presentation" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=efficient-javascript-development-1225481737770525-9&#038;stripped_title=efficient-java-script-development-presentation" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View SlideShare <a style="text-decoration:underline;" href="http://www.slideshare.net/wolframkriesing/efficient-java-script-development-presentation?type=powerpoint" title="View Efficient Java Script Development on SlideShare">presentation</a> or <a style="text-decoration:underline;" href="http://www.slideshare.net/upload?type=powerpoint">Upload</a> your own. (tags: <a style="text-decoration:underline;" href="http://slideshare.net/tag/aia2008">aia2008</a>)</div>
</div>
<p>The slides for &#8220;Architectures For Scaling Ajax Apps&#8221; are here.</p>
<div style="width:425px;text-align:left" class="mhx" id="__ss_710286"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/wolframkriesing/architectures-for-scaling-ajax-presentation?type=powerpoint" title="Architectures For Scaling Ajax">Architectures For Scaling Ajax</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=architectures-for-scaling-ajax-1225481209211093-9&#038;stripped_title=architectures-for-scaling-ajax-presentation" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=architectures-for-scaling-ajax-1225481209211093-9&#038;stripped_title=architectures-for-scaling-ajax-presentation" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View SlideShare <a style="text-decoration:underline;" href="http://www.slideshare.net/wolframkriesing/architectures-for-scaling-ajax-presentation?type=powerpoint" title="View Architectures For Scaling Ajax on SlideShare">presentation</a> or <a style="text-decoration:underline;" href="http://www.slideshare.net/upload?type=powerpoint">Upload</a> your own. (tags: <a style="text-decoration:underline;" href="http://slideshare.net/tag/aia2008">aia2008</a> <a style="text-decoration:underline;" href="http://slideshare.net/tag/presentation">presentation</a>)</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://uxebu.com/blog/2008/11/19/slides-from-the-ajax-in-action/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Duplicate line/selection&#8221; macro for Komodo</title>
		<link>http://uxebu.com/blog/2008/06/26/duplicate-lineselection-macro-for-komodo/</link>
		<comments>http://uxebu.com/blog/2008/06/26/duplicate-lineselection-macro-for-komodo/#comments</comments>
		<pubDate>Thu, 26 Jun 2008 16:43:05 +0000</pubDate>
		<dc:creator>wolfram</dc:creator>
				<category><![CDATA[development tools]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[komodo]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://blog.uxebu.com/?p=13</guid>
		<description><![CDATA[I don&#8217;t remember which IDE it was that made me learn to use the shortcuts (may be Turbo Pascal back then), and (almost) since then I am too lazy to learn new shortcuts. Now I always first customize the keyboard shortcuts. And already for a long time I am missing Ctrl+D/Apple+D for Komodo Edit which [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t remember which IDE it was that made me learn to use the shortcuts (may be Turbo Pascal back then), and (almost) since then I am too lazy to learn new shortcuts. Now I always first customize the keyboard shortcuts.<br />
And already for a long time I am missing Ctrl+D/Apple+D for <a href="http://www.activestate.com/Products/komodo_ide/komodo_edit.mhtml">Komodo Edit</a> which I use for editing JavaScript, CSS and HTML. This shortcut is supposed to duplicate either the current line or the entire selection. To make a long story short, here is <a href="http://www.vimeo.com/1237622">the screencast video</a> (1:04 min) that shows you how to apply the macro shown below.<br />
<span id="more-13"></span><br />
<script type="text/javascript">
// initHighlightOnLoad is deprecated.
// if parseOnLoad==true, the onLoad init stuff is run.
// if parseOnLoad==false, you can call dojox.highlight.init(domNode)
dojo.require("dojox.highlight");
dojo.require("dojox.highlight.languages.javascript");
dojo.addOnLoad(function(){
dojo.query("code").forEach(dojox.highlight.init);
});
</script></p>
<style type="text/css">
@import "http://blog.uxebu.com/js/dojo-1.1.1/dojox/highlight/resources/highlight.css";
</style>
<p>Since there seems to be no native implementation of that in Komodo I just took some JavaScript skills and the time to look into the macro stuff, and found out that it is actually pretty easy. After looking at the <a href="http://ASPN.ActiveState.com/ASPN/docs/Komodo/4.4/macroapi.html#macroapi_js">macro API doc</a> to find out how to differentiate if something is selected or not. It was as simple as recording the two macros and mixing them together, surrounded by an &#8220;if&#8221; that does the job right for the selection and the other for the current line. And I was done.</p>
<p>This is the end result. Just create a new macro and put the source there (the video shows how to do that in detail).</p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #006600; font-style: italic;">// Duplicate line/selection macro, more info at</span><br />
<span style="color: #006600; font-style: italic;">// http://blog.uxebu.com/2008/06/26/duplicate-lineselection-macro-for-komodo/</span><br />
komodo.<span style="color: #660066;">assertMacroVersion</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>komodo.<span style="color: #660066;">view</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> komodo.<span style="color: #660066;">view</span>.<span style="color: #660066;">setFocus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>ko.<span style="color: #660066;">views</span>.<span style="color: #660066;">manager</span>.<span style="color: #660066;">currentView</span>.<span style="color: #660066;">scimoz</span>.<span style="color: #660066;">selText</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// Copy the current selection</span><br />
&nbsp; &nbsp; komodo.<span style="color: #660066;">doCommand</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'cmd_copy'</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; komodo.<span style="color: #660066;">doCommand</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'cmd_lineNext'</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; komodo.<span style="color: #660066;">doCommand</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'cmd_linePrevious'</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; komodo.<span style="color: #660066;">doCommand</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'cmd_paste'</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// Copy the current line</span><br />
&nbsp; &nbsp; komodo.<span style="color: #660066;">doCommand</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'cmd_homeAbsolute'</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; komodo.<span style="color: #660066;">doCommand</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'cmd_selectLineNext'</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; komodo.<span style="color: #660066;">doCommand</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'cmd_copy'</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; komodo.<span style="color: #660066;">doCommand</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'cmd_paste'</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; komodo.<span style="color: #660066;">doCommand</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'cmd_paste'</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; komodo.<span style="color: #660066;">doCommand</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'cmd_linePrevious'</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p><object width="499" height="436"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=1237622&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://www.vimeo.com/moogaloop.swf?clip_id=1237622&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="499" height="436"></embed></object></p>
<p>Have fun duplicating &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://uxebu.com/blog/2008/06/26/duplicate-lineselection-macro-for-komodo/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

