<?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>Multunus &#187; Technology</title>
	<atom:link href="http://www.multunus.com/blog/all/the_technology/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.multunus.com</link>
	<description>Multunus Blog</description>
	<lastBuildDate>Mon, 30 Jan 2012 12:02:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Simple Image Filter using OpenGL ES in Android</title>
		<link>http://www.multunus.com/2011/10/simple-image-filter-using-opengl-es-in-android/</link>
		<comments>http://www.multunus.com/2011/10/simple-image-filter-using-opengl-es-in-android/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 15:35:45 +0000</pubDate>
		<dc:creator>Tamil</dc:creator>
				<category><![CDATA[All Posts]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.multunus.com/?p=1773</guid>
		<description><![CDATA[Note: This post assumes some basic knowledge in setting up an OpenGL app in Android. A basic example for rendering a texture on to a surface can be found here. You can use this as the initial setup for trying out Shader language program listed in this post.
OpenGL is widely adopted as the graphics API of [...]]]></description>
			<content:encoded><![CDATA[<p><em><strong>Note</strong>: This post assumes some basic knowledge in setting up an OpenGL app in Android. A basic example for rendering a texture on to a surface can be found <a href="http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/GLES20TriangleRenderer.html">here.</a> You can use this as the initial setup for trying out Shader language program listed in this post.</em></p>
<p>OpenGL is widely adopted as the graphics API of choice for real-time interactive 3D graphics applications. OpenGL is easy to understand, but its simplicity and orthogonality enable many interesting possibilities. One such possibility is image processing.</p>
<p>Using &#8220;OpenGL&#8221; for Image Processing enables us to completely utilize the power of Graphics Processing Unit (GPU) hence the image processing will be faster also it reduces the load on CPU. This can be crucial for Image processing applications, especially in mobile environment where the resources available are relatively lesser.</p>
<p>In this post we will be discussing how to use OpenGL Shader Language to manipulate pixels and create Image filter effects.</p>
<p><a rel="attachment wp-att-1851" href="http://www.multunus.com/2011/10/simple-image-filter-using-opengl-es-in-android/combined/"><img class="aligncenter size-medium wp-image-1851" src="http://www.multunus.com/wp-blog/wp-content/uploads/2011/10/combined-300x250.png" alt="" width="300" height="250" /></a></p>
<p>As with any OpenGL app, we will start with setting up the view.</p>
<p>The next step is to load an image into the texture, This texture can be mapped on to the surface of a square, which will then be drawn on to the screen.For Image processing, we will require only 2 dimensions so we will set up the view in orthographic projection and will also discard z axis by keeping it to 0.0 most of the times.</p>
<p>But before drawing to the screen, there are many intermediate operations that are done by the graphics hardware, which are now directly programmable in OpenGL ES 2.0 using Shader Language (GLSL).<br />
We will be concentrating on Vertex and Fragment processing phases in OpenGL pipeline. We will go through a simple fragment shader program and will explain how it works. Both of these programs are written in GLSL. GLSL is a ‘C’ like language which gives direct control over the  graphics pipeline without having to use assembly language or hardware-specific languages.</p>
<p><strong>Vertex shader</strong></p>
<pre class="brush: cpp;">
uniform mat4 uMVPMatrix;
attribute vec4 aPosition;
attribute vec2 aTextureCoord;
varying vec2 vTextureCoord;
void main() {
  gl_Position = uMVPMatrix * aPosition
  vTextureCoord = aTextureCoord
}
</pre>
<p dir="ltr">The Vertex shader is executed for each vertex that is to be drawn. Here, we are drawing a square and mapping the texture on to that.</p>
<p>This calculates the transformed coordinates of the square by multiplying the given coordinates with <a href="http://en.wikibooks.org/wiki/OpenGL_Programming/3D/Matrices" target="_blank">MVPMatrix</a> [ MVP -  Model * View * Projection ]. Other than this we are also storing corresponding texture co-ordinates in variable &#8217;<em>vTextureCoords&#8217;</em> so that it is available in the fragment shader.</p>
<p><strong>Fragment Shader</strong></p>
<pre class="brush: cpp;">
precision mediump float;
varying vec2 vTextureCoord;
uniform sampler2D sTexture;
void main() {
   vec2 cen = vec2(0.5,0.5) - vTextureCoord.xy;
   vec2 mcen = -0.07*log(length(cen))*normalize(cen);
   gl_FragColor = texture2D(sTexture, vTextureCoord.xy-mcen);
}
</pre>
<p dir="ltr">
<p>Fragment shaders are executed to calculate the color of individual pixels. This is where the actual image transformation happens. Instead of mapping the corresponding texture coordinates to corresponding pixels, we can map different coordinates of the texture to different pixels which will distort the image in some way. In the above example the texture co-ordinate to fill each pixel is chosen based on the calculation in line no 6. The actual movement depends on the distance of the texture coordinate from the center. This creates an effect which is similar to what is shown in the below picture.</p>
<p>Although this is a very simple effect, the intention here is to just show potential applications of OpenGL in Android apps.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.multunus.com/2011/10/simple-image-filter-using-opengl-es-in-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Continuous Delivery for Android Apps &#8211; Part 1</title>
		<link>http://www.multunus.com/2011/09/continuous-delivery-for-android-apps-part-1/</link>
		<comments>http://www.multunus.com/2011/09/continuous-delivery-for-android-apps-part-1/#comments</comments>
		<pubDate>Fri, 23 Sep 2011 11:15:50 +0000</pubDate>
		<dc:creator>Leena</dc:creator>
				<category><![CDATA[All Posts]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Continuous Delivery]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[continuousdelivery]]></category>

		<guid isPermaLink="false">http://www.multunus.com/?p=1705</guid>
		<description><![CDATA[
We&#8217;ve set up our CI server for building android apps. We use Jenkins as our CI server, but the same steps can be applied to any CI server.
Setup Android Environment on CI server
You need to first install the android SDK and platform tools on the CI server. The steps are well defined here. You can run [...]]]></description>
			<content:encoded><![CDATA[<div>
<p>We&#8217;ve set up our CI server for building android apps. We use Jenkins as our CI server, but the same steps can be applied to any CI server.</p>
<h3><span style="text-decoration: underline">Setup Android Environment on CI server</span></h3>
<p>You need to first install the android SDK and platform tools on the CI server. The steps are well defined <a href="http://developer.android.com/sdk/installing.html">here</a>. You can run the command <code>android update sdk --no-ui</code> if the CI server is in an headless environment.</p>
<h3><span style="text-decoration: underline">Generate Build script</span></h3>
<p>Using android SDK tool , you can generate build script for the android project which contains the standard steps for building the app such as clean, compile, release, install etc. The following command will generate the build script, replace &lt;appname&gt;, &lt;target&gt; and &lt;project path&gt; accordingly.</p>
<pre>android update project -n &lt;appname&gt; -t &lt;target&gt; -p &lt;project directory&gt;</pre>
<p>This will create build.xml file under the project directory. You need to create build.properties file with the following contents:</p>
<pre>key.store=path-to-keystore
key.alias=[alias]
key.store.password=[pw]
key.alias.password=[pw2]</pre>
<p>You can generate the key file using keytoool or you can generate the key file from eclipse. Run the command  <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace;line-height: 18px">ant clean release<span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height: 19px">, which will compile the files, and generate the apk files (it generates signed, unsigned and unaligned files). The signed version can be used for uploading to Android Market or for installing directly on any device. Couple of stuff to be noted here are:</span></span></p>
<ul>
<li>Ant version has to be 1.8.0 or higher.</li>
<li>Put the external libraries in the <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace;line-height: 18px">libs</span> directory. Build script automatically picks up the libraries put under libs directory, otherwise the script need to be changed to look at a different classpath.</li>
</ul>
<p>Checkin the build.xml, build.properties and the key file into the repository.</p>
<h3><span style="text-decoration: underline">Setup the CI server</span></h3>
<p>The CI server has to run the ant script for building the app. One more setting what we&#8217;ve done in our Jenkins server was to archive the apks as artifacts (available in the post build action). In upcoming posts, I will cover how to do the following:</p>
<ol>
<li>Running android tests</li>
<li>Running code/test coverage tools</li>
<li>Actual deployment</li>
</ol>
<p>References: <a href="http://skaug.no/ingvald/2011/09/android-app-with-jenkins/" target="_blank">http://skaug.no/ingvald/2011/09/android-app-with-jenkins/</a></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.multunus.com/2011/09/continuous-delivery-for-android-apps-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Continuous Delivery &#8211; Part 3: Running custom rake tasks during deployment</title>
		<link>http://www.multunus.com/2011/07/continuous-delivery-contd/</link>
		<comments>http://www.multunus.com/2011/07/continuous-delivery-contd/#comments</comments>
		<pubDate>Sun, 31 Jul 2011 15:50:54 +0000</pubDate>
		<dc:creator>Leena</dc:creator>
				<category><![CDATA[All Posts]]></category>
		<category><![CDATA[Continuous Delivery]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[continuousdelivery]]></category>

		<guid isPermaLink="false">http://www.multunus.com/?p=1482</guid>
		<description><![CDATA[One problem we faced with the pipeline setup what I had mentioned in my first post was that &#8211; it was not handling how to run the extra tasks that we need to do in some of the deployments. Some examples are:

Reindex the solr/lucene indexes if any new field has been added to the index
Some [...]]]></description>
			<content:encoded><![CDATA[<p>One problem we faced with the pipeline setup what I had mentioned in my <a href="http://www.multunus.com/2011/07/continuous-delivery-using-jenkins-build-pipeline/">first post</a> was that &#8211; it was not handling how to run the extra tasks that we need to do in some of the deployments. Some examples are:</p>
<ul>
<li>Reindex the solr/lucene indexes if any new field has been added to the index</li>
<li>Some custom rake tasks , say for eg: task to update values in the DB, which you don&#8217;t want to add to migrations</li>
</ul>
<p>We do have Cap tasks for running the required rake tasks, but again it was done manually. So we&#8217;ve to remember to run them after deploying to production.  And also there is no way to track what steps were followed for a certain deployment.</p>
<p>I used the build parameter again for fixing the above issue i.e. after accepting the extra tasks as parameter for the build for the first job, they will be passed on to the downstream jobs. In this way the same deployment steps will be automatically followed for rest of the jobs in the pipeline.</p>
<p>The only difference in this case is that &#8211; sometimes the parameter can be empty. This check has to be done in the scripts i.e. if the value exists for the parameter, execute the extra tasks along with the normal deployment else just do a normal deployment.</p>
<p>Continued..</p>
<ul>
<li><a title="Continuous Delivery – Part 1: Our Jenkins Build Pipeline setup" href="http://www.multunus.com/2011/07/continuous-delivery-using-jenkins-build-pipeline/">Continuous Delivery – Part 1: Our Jenkins Build Pipeline setup</a></li>
<li><a title="Continuous Delivery – Part 2: Code metrics with metrical" href="http://www.multunus.com/2011/07/continuous-delivery-code-metrics-with-metrical/">Continuous Delivery – Part 2: Code metrics with metrical</a></li>
<li><a title="Continuous Delivery – Part 4: Rolling back database migrations with Capistrano rollback" href="http://www.multunus.com/2011/08/continuous-delivery-part-3-rolling-back-database-migrations-with-capistrano-rollback/">Continuous Delivery – Part 4: Rolling back database migrations with Capistrano rollback</a></li>
</ul>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=0a6adeff-692b-401b-9726-093189c9c0b1" alt="Enhanced by Zemanta" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.multunus.com/2011/07/continuous-delivery-contd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Continuous Delivery &#8211; Part 2: Code metrics with metrical</title>
		<link>http://www.multunus.com/2011/07/continuous-delivery-code-metrics-with-metrical/</link>
		<comments>http://www.multunus.com/2011/07/continuous-delivery-code-metrics-with-metrical/#comments</comments>
		<pubDate>Sun, 31 Jul 2011 15:44:40 +0000</pubDate>
		<dc:creator>Leena</dc:creator>
				<category><![CDATA[All Posts]]></category>
		<category><![CDATA[Continuous Delivery]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.multunus.com/?p=1500</guid>
		<description><![CDATA[Metrical is for easier metric_fu setup. You can see the details on why and how here. Its an awesome tool which allows us to easily use metric_fu without adding any dependency to the project code.
The steps I followed for setting it up in our Jenkins server are:

 Install the gem. I installed it under our [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://iain.nl/easier-metricfu-with-metrical">Metrical</a> is for easier <a href="http://metric-fu.rubyforge.org/">metric_fu</a> setup. You can see the details on why and how <a href="http://iain.nl/easier-metricfu-with-metrical">here</a>. Its an awesome tool which allows us to easily use metric_fu without adding any dependency to the project code.</p>
<p>The steps I followed for setting it up in our Jenkins server are:</p>
<ul>
<li> Install the gem. I installed it under our ruby 1.9.2 in RVM.</li>
<li> Create a .metrics file under your projects directory with the settings. This is not mandatory, but I had to use this because some configurations do not seem to be working with ruby 1.9.2. I&#8217;ve mentioned those below along with the contents of the .metrics file</li>
<li> Create a job in Jenkins server, mention the repository details and for build step give the shell command as <em>rvm 1.9.2 -S metrical</em></li>
<li> Configure the <a href="https://wiki.jenkins-ci.org/display/JENKINS/HTML+Publisher+Plugin">HTML Publisher plugin</a> for showing the nice Graphs generated by metric_fu as part of the build report. The default report location is tmp/metric_fu/output under the project directory. You can change the same in .metrics file.</li>
</ul>
<p>As I mentioned above, tools such as flay and flog, which comes as part of metric_fu, have <a href="https://github.com/iain/metrical/issues/4">issues</a> working with ruby 1.9.2. And the same case with stats graph and syntax highlighting. The same case with <a href="https://github.com/relevance/rcov/issues/8">rcov</a> also. So I had to create a <em><strong>.metrics</strong></em> file with the following contents and put in the project dir:</p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px;"> </span></p>
<pre class="brush: ruby;">
MetricFu::Configuration.run do |config|
        config.code_dirs = ['app', 'lib']
        config.syntax_highlighting = false
        config.metrics  = [:churn,:reek,:roodi,:hotspots,:rails_best_practices]
        config.graphs   = [:reek, :roodi, :rails_best_practices]
        config.rcov[:test_files] = ['spec/**/*_spec.rb']
        config.rcov[:rcov_opts] &lt;&lt; &quot;-Ispec&quot; # Needed to find spec_helper
end
</pre>
<p>For test coverage I&#8217;ve used <a href="https://github.com/colszowka/simplecov">Simplecov</a> which is easy to setup. It will generate the coverage report whenever you run the tests. This also generated html report which can be integrated easily into Jenkins. As mentioned <a href="https://github.com/colszowka/simplecov/issues/42">here</a> in the issue list, it does not generate the report when you are running with <a href="https://github.com/timcharper/spork/wiki">spork</a>.</p>
<p>Continued..</p>
<ul>
<li><a title="Continuous Delivery – Part 1: Our Jenkins Build Pipeline setup" href="http://www.multunus.com/2011/07/continuous-delivery-using-jenkins-build-pipeline/">Continuous Delivery – Part 1: Our Jenkins Build Pipeline setup</a></li>
<li><a title="Continuous Delivery – Part 3: Running custom rake tasks during deployment" href="http://www.multunus.com/2011/07/continuous-delivery-contd/">Continuous Delivery – Part 3: Running custom rake tasks during deployment</a></li>
<li><a title="Continuous Delivery – Part 4: Rolling back database migrations with Capistrano rollback" href="http://www.multunus.com/2011/08/continuous-delivery-part-3-rolling-back-database-migrations-with-capistrano-rollback/">Continuous Delivery – Part 4: Rolling back database migrations with Capistrano rollback</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.multunus.com/2011/07/continuous-delivery-code-metrics-with-metrical/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Productivity Enhancement Tools &#8211; MailCatcher, Vogue, SpriteCow and RailsWizard</title>
		<link>http://www.multunus.com/2011/07/productivity-enhancement-tools-mailcatcher-vogue-spritecow-and-railswizard/</link>
		<comments>http://www.multunus.com/2011/07/productivity-enhancement-tools-mailcatcher-vogue-spritecow-and-railswizard/#comments</comments>
		<pubDate>Sun, 31 Jul 2011 15:03:40 +0000</pubDate>
		<dc:creator>KP</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.multunus.com/?p=1450</guid>
		<description><![CDATA[MailCatcher
A super simple SMTP server which catches any messages sent to it to display in a web interface. Configure the app to deliver to smtp://127.0.0.1:1025, then check out http://127.0.0.1:1080 to see all the mails being sent out of your application.
This really makes it easy to check emails generated by the application in development environment. Additionally [...]]]></description>
			<content:encoded><![CDATA[<h2><a href="https://github.com/sj26/mailcatcher">MailCatcher</a></h2>
<p>A super simple SMTP server which catches any messages sent to it to display in a web interface. Configure the app to deliver to smtp://127.0.0.1:1025, then check out http://127.0.0.1:1080 to see all the mails being sent out of your application.</p>
<p>This really makes it easy to check emails generated by the application in development environment. Additionally configuring this tool in your development environment makes sure that emails are not being sent to actual users unintentionally &#8211; very useful when you are trying to reproduce some issue with production environment data.</p>
<p><strong>Rating:</strong> Extremely useful</p>
<h2><a href="http://aboutcode.net/vogue/">Vogue</a></h2>
<p>Vogue creates a real-time link between your web browser and your file system. When you save a CSS file, used by the HTML page in your browser, Vogue will make the browser reload the stylesheet. Only the stylesheet is reloaded, not the entire page, making it work even for very dynamic/ajax pages.</p>
<p>A very useful tool, and it does save a lot of time when you are trying to check CSS changes across different browsers.</p>
<p>To make it work, you just have to install node.js and its package management tool &#8211; npm.</p>
<p><a href="https://github.com/joyent/node/wiki/Installation">Node installation instructions<br />
</a><a href="http://npmjs.org/">npm installation instructions</a></p>
<p>Vogue installation [Note: This a forked repo]</p>
<p>As of this writing there is a compatibility issue with Vogue and the socket.io package it uses, so instead of installing from the official repo use this repo instead [https://github.com/DTrejo/vogue.git].<strong><br />
</strong></p>
<p><strong>Rating:</strong> Extremely useful</p>
<h2><a href="http://www.spritecow.com/">SpriteCow</a></h2>
<p>Helps you get the background-position, width and height of sprits within a sprite sheet.</p>
<p>This tools works really well with sprite-sheets which has a transparent background [which is usually the case].</p>
<div><strong>Rating: </strong>Useful</div>
<div><strong> </strong></div>
<p><a rel="attachment wp-att-1458" href="http://www.multunus.com/2011/07/productivity-enhancement-tools-mailcatcher-vogue-spritecow-and-railswizard/sprite-cow/"><img class="size-medium wp-image-1458 alignnone" src="http://www.multunus.com/wp-blog/wp-content/uploads/2011/07/sprite-cow-300x187.png" alt="" width="300" height="187" /></a></p>
<h2><a href="http://railswizard.org/">RailsWizard</a></h2>
<p>Rails Wizard is a tool from Intridea which makes it easy to create application templates just by specifying the gems that you want to use.  It is available as a webapp as well as as stand alone tool.</p>
<p>Because of an incompatibility with the latest mysql2 gem and rails (3.0.x) this did not work me as expected.</p>
<p><strong>Rating</strong>: Moderately useful</p>
<p><a rel="attachment wp-att-1456" href="http://www.multunus.com/2011/07/productivity-enhancement-tools-mailcatcher-vogue-spritecow-and-railswizard/rails-wizard/"><img src="http://www.multunus.com/wp-blog/wp-content/uploads/2011/07/rails-wizard-300x187.png" alt="" width="300" height="187" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.multunus.com/2011/07/productivity-enhancement-tools-mailcatcher-vogue-spritecow-and-railswizard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Continuous Delivery &#8211; Part 1: Our Jenkins Build Pipeline setup</title>
		<link>http://www.multunus.com/2011/07/continuous-delivery-using-jenkins-build-pipeline/</link>
		<comments>http://www.multunus.com/2011/07/continuous-delivery-using-jenkins-build-pipeline/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 14:28:55 +0000</pubDate>
		<dc:creator>Leena</dc:creator>
				<category><![CDATA[All Posts]]></category>
		<category><![CDATA[Continuous Delivery]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.multunus.com/?p=1417</guid>
		<description><![CDATA[As part of our journey towards implementing Continous Delivery, I&#8217;ve added the Build pipeline for our continous integration server Jenkins.  There are quite a few resources available on the net on how to add the plugin and configure it. This blog is not about how to configure the plugin, but more on how I&#8217;ve configured [...]]]></description>
			<content:encoded><![CDATA[<p>As part of our journey towards implementing <a href="http://continuousdelivery.com/">Continous Delivery</a>, I&#8217;ve added the <a href="https://wiki.jenkins-ci.org/display/JENKINS/Build+Pipeline+Plugin">Build pipeline</a> for our continous integration server <a href="http://jenkins-ci.org/">Jenkins</a>.  There are quite a few resources available on the net on how to add the plugin and configure it. This blog is not about how to configure the plugin, but more on how I&#8217;ve configured it for one of our projects and issues I faced while doing the same.</p>
<p>The pipeline we have now is very simple. They are:</p>
<ul>
<li>Run all the RSpec tests</li>
<li>Run the Javascript Unit tests</li>
<li>Deploy to staging</li>
<li>Deploy to production</li>
</ul>
<p><strong>The problems we had with our earlier approach, and how the current approach solved those problems:</strong></p>
<p>What we had in the past was, simple scripts with the above items. We had a job for running the tests. If the build was successful, we would run <a href="https://github.com/capistrano/capistrano">capistrano</a> scripts to deploy to staging and once the customer gave the thumbs up, we&#8217;d push it to production.  There are a series of steps that we had to do for each deployment. For eg:  for staging deployment:</p>
<ul>
<li>Merge the &#8220;staging&#8221; branch with master</li>
<li>Run the cap script</li>
<li>Tag the build</li>
</ul>
<p>And almost similar steps needed to be followed for production deployment also. The usual problems that we used to face are:</p>
<ul>
<li>There is no way we knew what deployment was done on a certain day for what</li>
<li>All staging updates would not get pushed to production, so it was a tough task to identify which tag to merge when we were finally ready for a production update</li>
</ul>
<p>With the current approach, the advantages are:</p>
<ul>
<li>Its a one click deployment, so rare chance of making any kind of mistake</li>
<li>We can clearly see when a feature has been moved to staging, and whether it has been pushed to production or not</li>
<li>Anyone can do deployment as it is just a click of a button. We may even be able to teach the client how to do this.</li>
</ul>
<p>One of the major problems I had faced in the earlier &#8220;manual&#8221; system &#8211; was the inability to pass parameters between builds. For example, once the app would be moved to staging, a tag is created and when its ready to be pushed to production, we&#8217;d have to merge that particular tag to production and then push it.</p>
<p>To achieve the above I used the &#8220;parameterized build&#8221; option. In Jenkins, the parameters get converted to Environment Variables and got passed to the downstream job. This is how you can set the parameterized build:</p>
<p style="text-align: left;">
<a href="http://www.multunus.com/wp-blog/wp-content/gallery/images/parameterized_build_new.png" target="_new" title=""  >
	<img class="ngg-singlepic ngg-center" src="http://www.multunus.com/wp-blog/wp-content/gallery/cache/184__620x300_parameterized_build_new.png" alt="Parameterized Build" title="Parameterized Build" />
</a>
</p>
<p>When you fire the build, it prompts for the value of the TAG parameter. Once entered this would be available as an Environment variable for this job and all its downstream jobs.</p>
<p>For eg: in the pipeline, the downstream project is &#8220;Stage deploy&#8221;, and it will know the value for TAG and uses that value to create a tag in Git after successful deployment.</p>
<p>When it is ready for production deployment it merges with the same tag and deploys to production. In the latest version of the plugin, moving to the next step is <strong>not</strong> triggered automatically and you can retry the failed ones. The following is a sample pipeline dashboard view:</p>

<a href="http://www.multunus.com/wp-blog/wp-content/gallery/images/pipeline-new.png" target="_new" title=""  >
	<img class="ngg-singlepic ngg-center" src="http://www.multunus.com/wp-blog/wp-content/gallery/cache/183__620x300_pipeline-new.png" alt="Build Pipeline" title="Build Pipeline" />
</a>

<p><strong>Note:</strong> Capturing the parameter will happen <strong>only</strong> for the first job. So, if the parameterized job is <em>not</em> the first one in the pipeline, the capture of the parameter will not happen.</p>
<p>So we&#8217;ve reached the &#8220;one click deployment stage&#8221; with this. But we&#8217;ve still got the following pending tasks &#8211; based on what&#8217;s mention in the book  <a href="http://www.informit.com/store/product.aspx?isbn=0321601912">Continuous Delivery</a>:</p>
<ul>
<li>Rolling back the bad builds</li>
<li>Add non-functional tests to the pipeline i.e. performance and security tests</li>
<li>Feature flags</li>
<li>Zero downtime deployment</li>
<li>Canary Releases (Something on the lines of A/B testing)</li>
</ul>
<p>Continued..</p>
<ul>
<li><a title="Continuous Delivery – Part 2: Code metrics with metrical" href="http://www.multunus.com/2011/07/continuous-delivery-code-metrics-with-metrical/">Continuous Delivery – Part 2: Code metrics with metrical</a></li>
<li><a title="Continuous Delivery – Part 3: Running custom rake tasks during deployment" href="http://www.multunus.com/2011/07/continuous-delivery-contd/">Continuous Delivery – Part 3: Running custom rake tasks during deployment</a></li>
<li><a title="Continuous Delivery – Part 4: Rolling back database migrations with Capistrano rollback" href="http://www.multunus.com/2011/08/continuous-delivery-part-3-rolling-back-database-migrations-with-capistrano-rollback/">Continuous Delivery – Part 4: Rolling back database migrations with Capistrano rollback</a></li>
</ul>
<p>References:</p>
<ul>
<li><a href="http://weblogs.java.net/blog/johnsmart/archive/2011/03/10/build-pipelines-jenkinshudson">http://weblogs.java.net/blog/johnsmart/archive/2011/03/10/build-pipelines-jenkinshudson</a></li>
<li><a href="http://continuousdelivery.com/patterns">http://continuousdelivery.com/patterns</a></li>
<li><a href="http://www.quora.com/How-does-Etsy-manage-development-and-operations" target="_blank">http://www.quora.com/How-does-Etsy-manage-development-and-operations</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.multunus.com/2011/07/continuous-delivery-using-jenkins-build-pipeline/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rspec &#8211; Issue with &#8220;include helper&#8221; in spec</title>
		<link>http://www.multunus.com/2011/06/rspec-issue-with-include-helper-in-spec/</link>
		<comments>http://www.multunus.com/2011/06/rspec-issue-with-include-helper-in-spec/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 10:21:15 +0000</pubDate>
		<dc:creator>KP</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.multunus.com/?p=1387</guid>
		<description><![CDATA[There was an issue with our Rspec test suites in one of our projects where some of the tests which were green earlier suddenly started failing. When I checked Git commit which caused these failures, I couldn&#8217;t find anything suspicious. As for the tests that were failing, the only thing that was common among them was the exception which [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">There was an issue with our Rspec test suites in one of our projects where some of the tests which were green earlier suddenly started failing. When I checked Git commit which caused these failures, I couldn&#8217;t find anything suspicious. As for the tests that were failing, the only thing that was common among them was the exception which was causing them to fail.</p>
<p><strong>All the errors looked similar to this:</strong></p>
<p><code> </code></p>
<div style="padding-left: 30px;"><code><em>UserMailer send user activation email</em></code></div>
<p><code></p>
<div style="padding-left: 30px;"><em>Failure/Error: mail[:To].to_s.should eq(user.email)</em></div>
<div style="padding-left: 30px;"><em>ArgumentError:</em></div>
<div style="padding-left: 30px;"><em>wrong number of arguments (0 for 1)</em></div>
<div style="padding-left: 30px;"><em># ./app/helpers/application_helper.rb:42:in `display_name'</em></div>
<div style="padding-left: 30px;"><em># ./spec/mailers/user_mailer_spec.rb:10:in `block (3 levels) in &lt;top (required)&gt;'</em></div>
<div style="padding-left: 30px;"><em><br />
</em></div>
<p></code></p>
<p>Although the tests were failing, the functionality seemed to work just fine. So this had to be some issue with Specs. When I checked the code again I found that one of our view specs included ApplicationHelper, but unlike most of the other specs this one had the &#8221;include&#8221; statement <em>outside</em> the main ExampleGroup.</p>
<pre class="brush: ruby;">
 require 'spec_helper'
 include SearchHelper
 include ApplicationHelper
 describe &quot;/welcome/discover.html.haml&quot;
</pre>
<div>When I moved these &#8220;include&#8221; statements inside the describe the failing tests started passing.</div>
<pre class="brush: ruby;">
require 'spec_helper'
describe &quot;/welcome/discover.html.haml&quot;
  include SearchHelper
  include ApplicationHelper
</pre>
<div>I&#8217;m not exactly why it behaves this way &#8211; but it could be that the include statement which was outside the example group was being &#8220;mixed in&#8221; to the main object and was overriding other methods.</div>
]]></content:encoded>
			<wfw:commentRss>http://www.multunus.com/2011/06/rspec-issue-with-include-helper-in-spec/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running tests in parallel using parallel_tests</title>
		<link>http://www.multunus.com/2011/06/running-tests-in-parallel-using-parallel_tests/</link>
		<comments>http://www.multunus.com/2011/06/running-tests-in-parallel-using-parallel_tests/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 10:48:01 +0000</pubDate>
		<dc:creator>Leena</dc:creator>
				<category><![CDATA[All Posts]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.multunus.com/?p=1345</guid>
		<description><![CDATA[One of the action items I had mentioned in an earlier post, was to setup the  infrastructure for running tests in parallel.
I tried TLB, but stopped on it because it required cluster setup for our CI server i.e. hudson. I was looking for something which was even simpler than TLB, and tried Hydra, but could [...]]]></description>
			<content:encoded><![CDATA[<p>One of the action items I had mentioned in <a href="http://www.multunus.com/2011/06/takeaways-from-ruby-conf-india-2011/">an earlier post</a>, was to setup the  infrastructure for running tests in parallel.</p>
<p>I tried <a href="http://test-load-balancer.github.com/">TLB</a>, but stopped on it because it required cluster setup for our CI server i.e. hudson. I was looking for something which was even simpler than TLB, and tried <a href="https://github.com/ngauthier/hydra">Hydra</a>, but could not setup it successfully. Thankfully though, the Hydra committer  <a href="https://github.com/ngauthier/hydra/issues/48">suggested</a> that I try out  <a href="https://github.com/grosser/parallel_tests">parallel_tests</a> &#8211; as hydra is not currently being maintained.</p>
<p>I am yet to try running it parallelly on multiple machines, but I tried it on a dual core machine and can clearly see the difference. The following are the results:</p>
<p><strong>Without parallel_tests:</strong></p>
<pre>Finished in 451.01 seconds
1089 examples, 20 failures, 1 pending

real	8m14.908s
user	3m4.236s
sys	3m20.061s</pre>
<p><strong>With parallel_tests:</strong></p>
<pre>Results:
544 examples, 10 failures, 1 pending
545 examples, 10 failures

Took 330.528104223 seconds
Specs Failed

real	5m35.586s
user	7m3.150s
sys	0m14.269s</pre>
<p>The different is 2-3 minutes which I think is a huge deal.</p>
<p>I <a href="https://github.com/leenasn/parallel_tests">forked</a> parallel_tests to make a change to its default behaviour of running tests only under spec folder. As our app was built using rails engines, we had tests even under our vendor/engines directory.</p>
<p>The feature, I feel, missing in parallel_tests compared to TLB is the logic it uses to split the tests. TLB is intelligent enough to split the tests into different processes depending upon the time each test takes, so that all the threads finish by the same time. I am not sure whether how exactly parallel_tests works, but looks like it splits the total no of tests among the number of processes because when it started I could see the message:</p>
<pre>"2 processes for 162 specs, 81 specs per process"</pre>
<p>But parallel_tests by default spawns multiple processes depending upon the &#8220;core&#8221; i.e. on a dual core it starts 2 processes unless you mention otherwise.</p>
<p><strong>Update: </strong>We&#8217;ve fixed the 20 failures mentioned above. Those started coming all of a sudden, and how we have fixed the same can be found <a href="http://www.multunus.com/2011/06/rspec-issue-with-include-helper-in-spec/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.multunus.com/2011/06/running-tests-in-parallel-using-parallel_tests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CoffeeScript and Rails 3.0 &#8211; Quick setup</title>
		<link>http://www.multunus.com/2011/06/coffeescript-and-rails-3-0-quick-setup-2/</link>
		<comments>http://www.multunus.com/2011/06/coffeescript-and-rails-3-0-quick-setup-2/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 14:10:58 +0000</pubDate>
		<dc:creator>Manoj</dc:creator>
				<category><![CDATA[All Posts]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.multunus.com/?p=1304</guid>
		<description><![CDATA[I have been hearing a lot about CoffeeScript nowadays as you must have as well. Yes, it is built into Rails 3.1 by default. However I&#8217;m still working on a Rails 3.0 project, where I&#8217;m thinking of starting to use CoffeeScript. So, this blog post concentrates on how to quickly setup CoffeeScript into your existing [...]]]></description>
			<content:encoded><![CDATA[<p>I have been hearing a lot about CoffeeScript nowadays as you must have as well. Yes, it is built into Rails 3.1 by default. However I&#8217;m still working on a Rails 3.0 project, where I&#8217;m thinking of starting to use CoffeeScript. So, this blog post concentrates on how to quickly setup CoffeeScript into your existing Rails 3.0 project. For more details refer to the links at the bottom of this post.</p>
<p><strong>Step 1:</strong> Add these to Gemfile</p>
<pre class="brush: ruby;">
gem 'therubyracer', :require =&gt; false
gem 'barista'
</pre>
<p>&#8216;barista&#8217; gem takes care of installing coffee-script gem and its dependencies. &#8216;therubyracer&#8217; is the javascript engine for ruby.</p>
<p><strong>Step 2:</strong> Run Bundle Install to install coffee-script gem and other required gems</p>
<pre class="brush: bash;">
bundle install
</pre>
<p><strong>Step 3:</strong> Generate Barista initializer file config/initializers/barista_config.rb</p>
<pre class="brush: bash;">
rails generate barista:install
</pre>
<p><strong>Step 4(optional): </strong>Lets  configure barista to compile all coffeescript code into public/javascripts/coffeescripts/ folder (this is optional, if not configured compiled code will be placed under public/javascripts folder)</p>
<p>config/initializers/barista_config.rb, line 7.</p>
<pre class="brush: ruby;">
# Change the output root, causing Barista to compile into public/coffeescripts
c.output_root = Rails.root.join(&quot;public&quot;, &quot;javascripts&quot;, &quot;coffeescripts&quot;)
</pre>
<p><strong>Step 5:</strong> Create a folder &#8216;coffeescripts&#8217; under app/ to have all your coffeescripts. All file names should end with .coffee<br />
Example: app/coffeescripts/user.coffee</p>
<pre class="brush: ruby;">
jQuery -&gt;
 $('form').validate()
</pre>
<p><strong>Step 6:</strong> Above code will be complied to JS file under public/javascripts/coffeescripts/user.js. Example code:</p>
<pre class="brush: jscript;">
 /* DO NOT MODIFY. This file was compiled Thu, 23 Jun 2011 07:13:34 GMT from
 * /home/manoj/my_rails_app/app/coffeescripts/user.coffee
 */
 (function() {
 jQuery(function() {
 return $('form').validate();
 });
 }).call(this);
</pre>
<p><strong>Step 7:</strong> Include these coffeescript js files in your view/layouts using include tag.</p>
<pre class="brush: ruby;">
&lt;%= javascript_include_tag 'application', 'coffeescripts/user' %&gt;
</pre>
<p>And you&#8217;re done with setup. As the complied code is neat JS code, your page should continue to work fine <img src='http://www.multunus.com/wp-blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Going forward you can start using CoffeeScript for writing JS code.</p>
<p>For deployment we can use the <code>barista:brew</code> rake task in the Capistrano script using an &#8220;after&#8221; hook</p>
<p><strong>Refrences used to create above steps:</strong><br />
<a href="http://jashkenas.github.com/coffee-script/">http://jashkenas.github.com/coffee-script/</a><br />
<a href="http://blog.nicolasblanco.fr/2010/12/13/you-should-already-use-coffeescript-in-your-rails-app/">http://blog.nicolasblanco.fr/2010/12/13/you-should-already-use-coffeescript-in-your-rails-app/</a></p>
<p><strong>Convert existing JS to coffeescript:</strong><br />
<a href="http://ricostacruz.com/js2coffee/">http://ricostacruz.com/js2coffee/</a></p>
<p><strong>Setting up Emacs with coffee-mode:</strong><br />
<a href="http://ozmm.org/posts/coffee_mode.html">http://ozmm.org/posts/coffee_mode.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.multunus.com/2011/06/coffeescript-and-rails-3-0-quick-setup-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Takeaways from Ruby Conf India 2011</title>
		<link>http://www.multunus.com/2011/06/takeaways-from-ruby-conf-india-2011/</link>
		<comments>http://www.multunus.com/2011/06/takeaways-from-ruby-conf-india-2011/#comments</comments>
		<pubDate>Tue, 14 Jun 2011 13:58:56 +0000</pubDate>
		<dc:creator>Leena</dc:creator>
				<category><![CDATA[All Posts]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.multunus.com/?p=1290</guid>
		<description><![CDATA[I know its been almost two weeks since its all over, things may not be fresh in mind. And all of us were very busy with &#8220;go live&#8221; for one of our client projects. But as its &#8220;better later than never&#8221;, I am putting my thoughts about the recently concluded RubyConf held in Bangalore on [...]]]></description>
			<content:encoded><![CDATA[<p>I know its been almost two weeks since its all over, things may not be fresh in mind. And all of us were very busy with &#8220;go live&#8221; for one of our client projects. But as its &#8220;better later than never&#8221;, I am putting my thoughts about the recently concluded RubyConf held in Bangalore on 28th and 29th of May 2011.</p>
<p>There were quite a few presentations this year which I felt were very useful for me. Those are:</p>
<ul>
<li><a href="http://rubyconfindia.org/2011/presentations/brianGuthrie-RubyPlusRailsPlusAppMinusRails.key" target="_blank">Ruby Plus Rails Plus Your Application Minus Rails</a> by Brian Guthrie</li>
<li><a href="http://rubyconfindia.org/2011/presentations/janmejay-TLB-rocketBoosterForYourBuild.pdf" target="_blank">Test Load Balancer: Rocket Booster for your Build</a> by Janmejay Singh and Pavan</li>
<li><a href="http://rubyconfindia.org/2011/presentations/brianGuthrie-ContinuousDelivery.key" target="_blank">Continuous Delivery</a> in Ruby by Srushti Ambekallu and Brian Guthrie</li>
</ul>
<p>And its needless to say that the keynotes by Yehuda Katz, Chad Fowler, Nick Sieger and Ola Bini were awesome too. Especially<a href="http://rubyconfindia.org/2011/presentations/chadFowler-service.key" target="_blank"> Chad Fowler&#8217;s session</a> gave a new perspective on &#8220;Service&#8221; and who should be considered as a &#8220;Customer&#8221;. And Nick Sieger&#8217;s closing note gave a different perspective on how to contribute back to the community by conducting workshops and with <a href="http://kidsruby.com/" target="_blank">Kidsruby</a>.</p>
<p>So whats next? Yes, implement the stuff we learned. So these are the immediate action items for us:</p>
<ul>
<li>More automation for the entire release mechanism. We do have a CI server and do have a Cap script for deployment. But we do not have a &#8220;one click deployment&#8221; process. A &#8220;<a href="http://www.google.com/url?sa=D&amp;q=http://code.google.com/p/build-pipeline-plugin/">Build pipeline</a>&#8221; plugin for Hudson should help us achieve that.</li>
<li>Tools like <a href="http://wiki.opscode.com/display/chef/Home">Chef</a>/<a href="http://www.puppetlabs.com/puppet/introduction/">Puppet</a> for server configuration management. We&#8217;ve tried <a href="https://github.com/wr0ngway/rubber/wiki">rubber</a>, but are yet to use it for any production setup.</li>
<li>Use <a href="http://test-load-balancer.github.com/">TLB</a> to run tests in parallel.  Setup seem to be pretty straightforward. This will be a huge help when you are doing many deployment in a day.</li>
</ul>
<p><strong>Update: </strong>One talk I missed in the list was <a href="http://rubyconfindia.org/2011/presentations/sherinC-DesigningHighThroughputWebServiceClients.key">Designing High Throughput Web Service Clients</a> by Sherin. He was able to convey the problems he faced and how he went ahead and solved those.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.multunus.com/2011/06/takeaways-from-ruby-conf-india-2011/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

