<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.southworks.net/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Johnny Halife's Blog</title>
	
	<link>http://blogs.southworks.net/jhalife</link>
	<description />
	<pubDate>Sun, 21 Feb 2010 03:51:54 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.southworks.net/jhalife" /><feedburner:info uri="jhalife" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>self rebase #01</title>
		<link>http://feeds.southworks.net/~r/jhalife/~3/9gN_Cmd9sXY/</link>
		<comments>http://blogs.southworks.net/jhalife/2010/02/20/self-rebase-01/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 15:53:40 +0000</pubDate>
		<dc:creator>jhalife</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/jhalife/2010/02/20/self-rebase-01/</guid>
		<description><![CDATA[Taken from the rebase concept of git which is also used by GitHub to show they newsworthy and notable projects, I’m using the post to do the same with bunch of Open Source, shared, hacking projects I’ll be doing lately.
Since 2010 started, I didn’t blogged that often, but there were a couple of projects that [...]]]></description>
			<content:encoded><![CDATA[<p>Taken from the <a href="http://mirror.averse.net/pub/software/scm/git/docs/v1.6.0.6/git-rebase.html">rebase concept of git</a> which is also used by <a href="http://github.com/blog/593-github-rebase-35">GitHub</a> to show they newsworthy and notable projects, I’m using the post to do the same with bunch of Open Source, shared, hacking projects I’ll be doing lately.</p>
<p>Since 2010 started, I didn’t blogged that often, but there were a couple of projects that I’ve been working lately. Throughout this post, I’ll describe each one and the futures.</p>
<p>Every piece of feedback will be welcome, as every other contribution too.</p>
<p>Enjoy the ride,<br />
~johnny</p>
<h2>Rack::Auth::WRAP, the OAuth WRAP Middleware</h2>
<p>Yesterday, with <a href="http://twitter.com/jpgd">Juan Pablo</a>, we published our first version of <strong>Rack::Auth::WRAP</strong> the first version of the <a href="http://rack.rubyforge.org/">Rack</a>. If you are familiar with the protocol, you can skip the next section if not, take a look at it. Extracted from the read me at <a href="http://github.com/johnnyhalife/rack-oauth-wrap">github.com</a>.</p>
<h3>What the heck is WRAP?</h3>
<p>Web Resource Authorization Protocol (WRAP) is a profile of OAuth, also called OAuth WRAP. While similar in pattern to OAuth 1.0A, the WRAP profile(s) have a number of important capabilities that were not available previously in OAuth. This specification is being contributed to the IETF OAuth WG.</p>
<p>Also this same group owns the specification for the SWT (Simple-Web-Token), for more information read <a href="wiki.oauth.net/OAuth-WRAP">wiki.oauth.net/OAuth-WRAP</a> or visit the <a href="groups.google.com/group/oauth-wrap-wg">groups.google.com/group/oauth-wrap-wg</a>.</p>
<p>The latest specification for the complete protocol can be found at Google Group as HTML (RFC properly formatted) on <a href="groups.google.com/group/oauth-wrap-wg/attach/981df73f2839b8ef/draft-hardt-oauth-wrap-01.html?part=5">groups.google.com/group/oauth-wrap-wg/attach/981df73f2839b8ef/draft-hardt-oauth-wrap-01.html?part=5</a></p>
<h3>Creating your first protected resource</h3>
<p>As you might be thinking, our first resource will be a <a href="www.sinatrarb.com">Sinatra</a> application.</p>
<p>First of all we need to install the gem, as</p>
<pre style="border:solid 1px #cccbba;font:normal normal normal 12px LuxiMono,'Bitstream Vera Sans Mono',Monaco,'Courier New',monospace;color:#1c360c">[sudo] gem install rack-oauth-wrap</pre>
<p>To make the sample easier let’s create our own shared key, we can all share this for demo purpose <strong>NjkzNTczOTAtMDA2MC0wMTJkLTQ1M2YtMDAyMzMyYjFmYWY4\n</strong></p>
<p>So let’s start by creating the protected resource</p>
<pre style="border:solid 1px #cccbba;font:normal normal normal 12px LuxiMono,'Bitstream Vera Sans Mono',Monaco,'Courier New',monospace;color:#1c360c;width: 660px;padding: 5px">require 'rubygems'
require 'sinatra'
require 'rack/auth/wrap'

use Rack::Auth::WRAP, :shared_secret =&gt;t; "NjkzNTczOTAtMDA2MC0wMTJkLTQ1M2YtMDAyMzMyYjFmYWY4",
                      :audiences =&gt;; "http://localhost:4567",
                      :trusted_issuers =&gt;; "urn:demo-issuer"

get "/" do
    if @env["REMOTE_USER"]
        return &#8220;You are authenticated as #{@env["REMOTE_USER"]['Email']}&#8221;
    else
        return &#8220;You are an unauthenticated user&#8221;
    end
end</pre>
<p>Now we can start this on a Terminal (cmd, or whatever) and let’s jump to the consumer, but first if you try it without sending a token, and using the client we are going to build, you will get:</p>
<pre style="border:solid 1px #cccbba;font:normal normal normal 12px LuxiMono,'Bitstream Vera Sans Mono',Monaco,'Courier New',monospace;color:#1c360c">?&gt; curl http://localhost:45678
You are unauthenticated</pre>
<p>Now lets create a client trying to access a protected resource with a token on the header (requires <a href="http://rest-client.heroku.com">restclient</a>)</p>
<pre style="border:solid 1px #cccbba;font:normal normal normal 12px LuxiMono,'Bitstream Vera Sans Mono',Monaco,'Courier New',monospace;color:#1c360c;width: 900px;padding: 5px">require 'rubygems'
require 'cgi'
require 'base64'
require 'restclient'
require 'hmac/sha2'

SHARED_SECRET = "NjkzNTczOTAtMDA2MC0wMTJkLTQ1M2YtMDAyMzMyYjFmYWY4\n"

simple_web_token = {'Audience' =&gt;; "http://localhost:4567",
                    'Issuer' =&gt;; "urn:demo-issuer",
                    'ExpiresOn' =&gt;; (Time.now.to_i + 60).to_s,
                    'Email' =&gt;; 'johnny.halife@sample.com'}.map{|k, v| "#{k}=#{CGI.escape(v)}"}.join("&amp;")

signature = Base64.encode64(HMAC::SHA256.new(Base64.decode64(SHARED_SECRET)).update(simple_web_token.toutf8).digest).strip
simple_web_token += "&amp;HMACSHA256=#{CGI.escape(signature)}"

puts RestClient.get("http://localhost:4567/", "Authorization" =&gt;; "WRAP access_token=#{CGI.escape(simple_web_token)}")</pre>
<p>Now let’s try our client, and see if there’s any difference with the <em>curl</em> request:</p>
<pre style="border:solid 1px #cccbba;font:normal normal normal 12px LuxiMono,'Bitstream Vera Sans Mono',Monaco,'Courier New',monospace;color:#1c360c">?&gt; ruby client.rb
You are authenticated as johnny.halife@sample.com</pre>
<p>As you can see, we have our first end to end, Rack::Auth::WRAP Sample.</p>
<p><strong>DISCLAIMER: On a real world application you won’t generate your own token as we are doing on the client code. We are doing it for demo purposed, but probably on you app you will get a token from an authorization server. </strong></p>
<p>Both snippets are available as gits on github: <a href="http://gist.github.com/309717">Protected Resource</a> / <a href="http://gist.github.com/309732">Client</a>. We are assuming that this is running on localhost:4567</p>
<h3>TODO’s and futures</h3>
<p>On the upcoming days/weeks/months we are going to get on the middleware support for the other ways of getting the token, like Query String and/or method body. Also we would like to implement the <em>Web Profile</em> of WRAP, so stay tuned.</p>
<p>You can read the freshly published documentation at <a href="http://rack-oauth-wrap.heroku.com">http://rack-oauth-wrap.heroku.com</a></p>
<p><strong>Source Code available at</strong>:  <a href="http://github.com/johnnyhalife/rack-oauth-wrap">http://github.com/johnnyhalife/rack-oauth-wrap</a></p>
<h2>OAuth WRAP 0.9 for Tcl</h2>
<p>First of all, if you aren’t familiar with Tcl it’s “originally from “Tool Command Language”, but conventionally<br />
rendered as Tcl is a scripting language created by John Ousterhout”. I encourage you to test it and also if you are interested read <a href="http://blogs.activestate.com/2010/02/where-is-tcl-hiding/">Where’s Tcl hiding?</a>.</p>
<p>This project was born after half an hour spiking on how hard it will be to parse a token on a bare linux distro that only has Tcl. After we noticed that Tcl is really straightforward language for design, prototype and is fun to write, we packed this lib and make it available for anyone interested.</p>
<p>Here’s an snippet of the intended usage of the lib</p>
<pre style="border:solid 1px #cccbba;font:normal normal normal 12px LuxiMono,'Bitstream Vera Sans Mono',Monaco,'Courier New',monospace;color:#1c360c;width: 675px;padding: 5px">package require ::oauth::wrap

set rawToken "access_token=something&amp;other_parameters_to_ignore" #=&gt; the token from the IP

# =&gt; creates a configuration dictionary for the values
dict set configuration signingKey {valid_key} # =&gt; signing key used by the Identity Provider
dict set configuration issuer {valid_issuer} # =&gt; the identity provider URI
dict set configuration audience {valid_audience}  # =&gt; my application audience URI

# this will return the token when it's valid else it will return false
set token [oauth::wrap::authenticate $configuration $rawToken]

# at this point if the token valid you can mess around with its claims
# that are returned on a dictionary form
set name [dict get $token name]</pre>
<p>It’s fun to give it a shot, check out the source code at <strong><a href="http://github.com/johnnyhalife/tcl-oauth-wrap">http://github.com/johnnyhalife/tcl-oauth-wrap</a></strong></p>
<h2>Windows Azure Storage for Ruby v1.0</h2>
<p>On the 4th February, 2010 <strong>I’ve published the version 1.0 of ruby gem I wrote for Windows Azure Storage</strong>. This time it has the great contribution of my friend <a href="http://twitter.com/jpgd">Juan Pablo Garcia Dalolla</a> <strong>who has implemented the Windows Azure Tables support</strong>.</p>
<p>This version of the gem also includes support for the version 2009-09-19.</p>
<p>Here’re are some code snippets from the Windows Azure Tables support</p>
<pre style="border:solid 1px #cccbba;font:normal normal normal 12px LuxiMono,'Bitstream Vera Sans Mono',Monaco,'Courier New',monospace;color:#1c360c;width: 800px;padding: 5px">require 'waz-storage'
require 'waz-tables'

# The same connection of Windows Azure Storage Core (Queues, Blobs) can be reused
WAZ::Storage::Base.establish_connection!(:account_name =&gt;; account_name,
                                         :access_key =&gt;; access_key)

# Grab the service instance
service = WAZ::Tables::Table.service_instance

# Query the customer table
service.query('customer_table', {:expression =&gt;; "(PartitionKey eq 'customer') and (Age eq 23)", :top =&gt;; 15} )

# Insert something into the customer table
serivce.query('customer_table', {:row_key =&gt;; 'my_custom_id', :name =&gt;; 'johnny'})</pre>
<p>There’s also a DataMapper adapter effort going on for Windows Azure Storage Tables, <strong>I recommend you to check out Juan Pablo’s post about <a href="http://blogs.southworks.net/jpgarcia/2010/02/08/windows-azure-tables-adapter-for-datamapper/">Windows Azure Tables Adapter for Datamapper</a></strong></p>
<p><strong>Source Code available at: <a href="http://github.com/johnnyhalife/waz-storage">http://github.com/johnnyhalife/waz-storage</a></strong></p>
<p><strong>RDoc available at: <a href="http://waz-storage.heroku.com">http://github.com/johnnyhalife/waz-storage</a></strong></p>
<img src="http://feeds.feedburner.com/~r/jhalife/~4/9gN_Cmd9sXY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/jhalife/2010/02/20/self-rebase-01/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.southworks.net/jhalife/2010/02/20/self-rebase-01/</feedburner:origLink></item>
		<item>
		<title>Windows Azure Storage SDK for Ruby v0.5.6 now available!</title>
		<link>http://feeds.southworks.net/~r/jhalife/~3/Xe5Vp0VSvZo/</link>
		<comments>http://blogs.southworks.net/jhalife/2009/12/02/windows-azure-storage-sdk-for-ruby-v056-now-available/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 13:08:13 +0000</pubDate>
		<dc:creator>jhalife</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/jhalife/?p=162</guid>
		<description><![CDATA[Hey Folks, after PDC 09&#8242; I&#8217;m back on track doing some work on the Windows Azure Storage SDK for Ruby. On my Channel9 interview, I told you that Ray Ozzie announced a new version of Windows Azure Storage API (a.k.a 2009-09-19) which enables developers to perform new tasks on the storage components
These are the enhancements [...]]]></description>
			<content:encoded><![CDATA[<p>Hey Folks, after PDC 09&#8242; I&#8217;m back on track doing some work on the Windows Azure Storage SDK for Ruby. <a href="http://blogs.southworks.net/jhalife/2009/11/23/windows-azure-storage-sdk-for-ruby-on-channel9/">On my Channel9 interview</a>, I told you that Ray Ozzie announced<a href="http://msdn.microsoft.com/en-us/library/dd894041.aspx"> a new version of Windows Azure Storage API (a.k.a 2009-09-19)</a> which enables developers to perform new tasks on the storage components</p>
<p>These are the enhancements for the<strong> 0.5.6 version of the SDK,</strong> <strong>this release only covers the Windows Azure Queues Service 2009-09-19 version</strong>, <strong>Blobs support will be released end of this week or early next week.</strong></p>
<h2>What&#8217;s new on the 0.5.6 version?</h2>
<ul>
<li>Added new<span class="Apple-converted-space"> </span><strong>shared key authentication support for 2009-09-19 Version of the Storage API</strong></li>
<li>Queues API has been migrated to the<span class="Apple-converted-space"> </span><strong>2009-09-19 Version of the Storage API</strong></li>
<li>Added a new parameter for<span class="Apple-converted-space"> </span><strong>Listing Queues with Metadata</strong></li>
<li>Added support for<span class="Apple-converted-space"> </span><strong>DequeueCount</strong><span class="Apple-converted-space"> </span>on messages being retrieved from the Queue</li>
<li><strong>Known Issue</strong>: Creating a queue multiple times with same metadata throws 409.</li>
</ul>
<h2>Using the latest version of the Windows Azure Storage SDK for <em>Poison Message detection</em></h2>
<pre style="font-size: 12px">  WAZ::Storage::Base.establish_connection!(:account_name =&gt; 'name', :access_key =&gt; 'key')

  # Let's start by selecting a queue
  queue = WAZ::Queues::Queue.find('my-queue')

  # While the queue has messages, let's check the content
  while (queue.size &gt; 0) do
    # Now let's dequeue a message as we usually do we the API
    message = queue.lock

    # Before processing the message we can now do a sanity check for the message
    # if the message has been dequeued more than 5 times we will destroy it since
    # it can be a <em>poison message</em>.
    if (message.<strong>dequeue_count</strong> &gt; 5)
        message.destroy!
    else
        # We process the message as we usually do
    end
  end</pre>
<p>The <strong>key feature on this version of the API is the dequeue_count </strong>property for Queues which serves the primary goal, as shown sample above, of <em>Poison Message</em> detection.</p>
<p>Stay tuned for further updates on the SDK&#8230;</p>
<p>thanks,<br />
~johnny</p>
<img src="http://feeds.feedburner.com/~r/jhalife/~4/Xe5Vp0VSvZo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/jhalife/2009/12/02/windows-azure-storage-sdk-for-ruby-v056-now-available/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.southworks.net/jhalife/2009/12/02/windows-azure-storage-sdk-for-ruby-v056-now-available/</feedburner:origLink></item>
		<item>
		<title>Windows Azure Storage SDK for Ruby on Channel9</title>
		<link>http://feeds.southworks.net/~r/jhalife/~3/bLW3lPPPs5Y/</link>
		<comments>http://blogs.southworks.net/jhalife/2009/11/23/windows-azure-storage-sdk-for-ruby-on-channel9/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 03:51:23 +0000</pubDate>
		<dc:creator>jhalife</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/jhalife/?p=161</guid>
		<description><![CDATA[Since, the first release of the Windows Azure Storage SDK for Ruby, I&#8217;ve received retweets and comments from Jean-Christophe Cimetiere (Sr. Technical Evangelist - Interop Strategy Team at Microsoft), we never met in person until Ezequiel Glinsky put us in contact.

I traveled to PDC 09&#8242; to work on the Keynote and stuff for the event. [...]]]></description>
			<content:encoded><![CDATA[<p>Since, the first release of the <a href="http://blogs.southworks.net/jhalife/2009/10/16/announcing-ruby-windows-azure-storage-sdk-v05/">Windows Azure Storage SDK for Rub</a>y, I&#8217;ve received retweets and comments from<a href="http://blogs.msdn.com/jccim/"> Jean-Christophe Cimetiere</a> (Sr. Technical Evangelist - Interop Strategy Team at Microsoft), we never met in person until <a href="http://eglinsky.spaces.live.com/">Ezequiel Glinsky</a> put us in contact.<br />
<a href="http://channel9.msdn.com/posts/jccim/Using-Windows-Azure-storage-from-Ruby/" target="_blank"><img class="alignright" style="float: right;margin: 5px;border: 0px" src="http://files.me.com/johnny.halife/0o2ntg" alt="" width="341" height="249" /></a><br />
I traveled to PDC 09&#8242; to <a href="http://blogs.southworks.net/jhalife/2009/11/19/pdc-09-tales-from-the-trenches/">work on the Keynote and stuff for the event</a>. Thanks to <a href="http://twitter.com/jccim">JC</a>, I was able<a href="http://channel9.msdn.com/posts/jccim/Using-Windows-Azure-storage-from-Ruby/"> to record a short demo/interview with him for Channel9</a>. The interview is for those that doesn&#8217;t know the work we have been doing and also to get you and idea of where this work is going to.</p>
<p>The SDK stills in beta, and we&#8217;ve already implemented a couple of features of the<a href="http://msdn.microsoft.com/en-us/library/dd894041.aspx"> 2009-09-19 version of the API</a> announced by <a href="http://microsoftpdc.com">Ray Ozzie on the Microsoft PDC 09&#8242;</a>. I hope you like it and any comments will be always welcomed.</p>
<p>As usual thanks to my team: <a href="http://twitter.com/jpgd">Juan Pablo Garcia</a> and <a href="http://twitter.com/ezequielm">Ezequiel Morito</a> major advisors and contributors of this project.</p>
<p>thanks,<br />
~johnny</p>
<img src="http://feeds.feedburner.com/~r/jhalife/~4/bLW3lPPPs5Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/jhalife/2009/11/23/windows-azure-storage-sdk-for-ruby-on-channel9/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.southworks.net/jhalife/2009/11/23/windows-azure-storage-sdk-for-ruby-on-channel9/</feedburner:origLink></item>
		<item>
		<title>PDC 09′ - Tales from the Trenches</title>
		<link>http://feeds.southworks.net/~r/jhalife/~3/lpIExIiRZBU/</link>
		<comments>http://blogs.southworks.net/jhalife/2009/11/19/pdc-09-tales-from-the-trenches/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 21:56:50 +0000</pubDate>
		<dc:creator>jhalife</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/jhalife/?p=160</guid>
		<description><![CDATA[
About a month ago, I left my home in Buenos Aires to start working with James Conard and his team on the &#8220;Cloud Convergence&#8221; Demo and some other PDC 09&#8242; Stuff. Today since Ray Ozzie touched the stage we (backstage) were waiting for our demo to become true. Before that were a couple of demos, [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" style="float: right" src="http://files.me.com/johnny.halife/nkiu12" alt="Convergence Demo" width="357" height="274" /></p>
<p>About a month ago, I left my home in Buenos Aires to start working with James Conard and his team on the &#8220;Cloud Convergence&#8221; Demo and some other PDC 09&#8242; Stuff. Today since Ray Ozzie touched the stage we (backstage) were waiting for our demo to become true. Before that were a couple of demos, and specially (and I&#8217;ll talk about this later on this post) <strong>&#8220;Tailspin Travel&#8221;</strong>.</p>
<p>When we got to Redmond area, we met<a href="http://www.lostintangent.com"> Jonathan Carter (a.k.a JC)</a> who was working with PC (a fellow southy), they were working on the <a href="http://tailspin.codeplex.com">&#8220;Tailspin Travel&#8221; </a> demo for the keynote that was shown by <a href="http://blogs.msdn.com/camerons/">Cameron Skinner</a>. Tailpin&#8217;s demo represents most of the &#8220;best practices&#8221; that you should apply when doing an ASP.NET MVC Web Application that has features like back-end support with Workflow and other WCF Services, and integrates with your Enterprise Identity using WS-Federation Protocol.</p>
<p>Imagine how good the demo was, that we took that same application to do our work on the &#8220;Future of the Platform&#8221;.  Additionally, they are doing something great with the application that since the keynote was available for you to <a href="http://tailspintravel.codeplex.com/">download</a> it and learn the &#8220;goodies&#8221; of .NET 4/WIF/AppFabric development.</p>
<h2>Tailspin Travel</h2>
<p><img class="alignright" style="float: right" src="http://lostintangent.com/wp-content/uploads/2009/11/logo.png" alt="Tailspin Travel" /></p>
<p>The Tailspin Travel application covers a pretty substantial set of functionality, but ultimately seeks to provide a holistic perspective of how Visual Studio 2010, .NET Framework 4,</p>
<p>and the server platform can be used together. Among other technologies it leverages: Visual Studio 2010 (with the new fancy diagrams), .NET 4.0 (MVC2, WIF, WF, WCF, and so) andshow the hosting layer of your services using the brand-new &#8220;AppFabric&#8221;</p>
<p>I guess at this point of the post you should be rushing to <a href="http://tailspintravel.codeplex.com/">get the bits</a>, and if you don&#8217;t go new to get them at http://tailspintravel.codeplex.com/.</p>
<h2>Meet me at PDC</h2>
<p><img class="alignright" style="float: right;margin: 2px" src="http://microsoftpdc.com/content/images/creative/PDC09Bling_General_ThreadsConnected_136.jpg" alt="Meet me at PDC" width="136" height="186" /></p>
<p>I&#8217;m on PDC with other fellow <a href="http://southworks.net">Southies,</a> we are all the time around, and if you want to talk and share a coffee, just look for me or DM message at <a href="http://twitter.com/johnnyhalife">@johnnyhalife</a> on twitter and we will meet for sure.</p>
<p>Today I&#8217;ve been interviewed by Jean-Christophe Cimetiere about the work I&#8217;m doing with Ruby and Azure. You should stay tuned for more information that I&#8217;ll be announcing soon on these things, like Azure 2009-09-19 support of the API on the Ruby SDK.</p>
<h3>Acknowledments</h3>
<p>Although Matías , PC and I where backstage, there were lots of Southies that made these PDC events work great, I sincerely appreciate the work all the Southies were doing, and how do they helped us.</p>
<p>hope to see you around,</p>
<p>~johnny</p>
<img src="http://feeds.feedburner.com/~r/jhalife/~4/lpIExIiRZBU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/jhalife/2009/11/19/pdc-09-tales-from-the-trenches/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.southworks.net/jhalife/2009/11/19/pdc-09-tales-from-the-trenches/</feedburner:origLink></item>
		<item>
		<title>Issues running Windows Azure SDK (Ruby/C#) from Local Time when GMT -3 change didn’t happen</title>
		<link>http://feeds.southworks.net/~r/jhalife/~3/AQAbALsvFl8/</link>
		<comments>http://blogs.southworks.net/jhalife/2009/10/19/issues-running-windows-azure-sdk-rubyc-from-local-time-when-gmt-3-change-didnt-happen/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 17:26:02 +0000</pubDate>
		<dc:creator>jhalife</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/jhalife/?p=159</guid>
		<description><![CDATA[I was working on the Ruby Windows Azure SDK and I started receiving HTTP/1.1 403 errors, I figured out which is the problem so here you can get a simple issue analysis
Symptom
While trying to connect to Windows Azure (Storage at least) from Argentina, you get 403 errors even dough the message seems to be formatted [...]]]></description>
			<content:encoded><![CDATA[<p>I was working on the Ruby Windows Azure SDK and I started receiving HTTP/1.1 403 errors, I figured out which is the problem so here you can get a simple issue analysis</p>
<p><strong>Symptom</strong><br />
While trying to connect to Windows Azure (Storage at least) from Argentina, you get 403 errors even dough the message seems to be formatted correctly.</p>
<p><strong>Issue</strong><br />
Argentina was supposed to change the time by adjusting it to DTS (Daylight Time Saving), one day before that happens the Argentinean Government decided not to make that change, generating a lots of implications for computer systems adjusted to DTS. </p>
<p>Since Windows Azure relays on UTC Timestamp for making an assertion on the signature, the current time for GMT -3 isn&#8217;t what is expected from the server side causing the whole message to fail after the an assertion of the signature.</p>
<p><strong>Workaround</strong><br />
There&#8217;s no apparent solution yet, but there are a couple of workarounds in order to properly develop against Windows Azure from a not changed GMT -3 time zone.</p>
<ul>
<li><strong>Change your time zone to GMT -4</strong>. I switched my computer back to Halifax - Canada that has GMT -4 for an Windows Azure started accepting my requests
</li>
<li><strong> Keep your computer with the clock one hour ahead </strong>. Keep the current time zone without tweaking the Date/Time, but remember that you will be out of sync with the country</li>
</ul>
<p>Both of the workarounds listed above proved to be successfully working, I will stick with GMT -4 since I guide myself (eating, sleeping, and all that) in my computer clock.</p>
<p>Hope it helps,<br />
~johnny</p>
<img src="http://feeds.feedburner.com/~r/jhalife/~4/AQAbALsvFl8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/jhalife/2009/10/19/issues-running-windows-azure-sdk-rubyc-from-local-time-when-gmt-3-change-didnt-happen/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.southworks.net/jhalife/2009/10/19/issues-running-windows-azure-sdk-rubyc-from-local-time-when-gmt-3-change-didnt-happen/</feedburner:origLink></item>
		<item>
		<title>Contextual connection handling on Ruby WAZ-Storage</title>
		<link>http://feeds.southworks.net/~r/jhalife/~3/_dqmO7tSXZ0/</link>
		<comments>http://blogs.southworks.net/jhalife/2009/10/18/contextual-connection-handling-on-ruby-waz-storage/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 17:49:07 +0000</pubDate>
		<dc:creator>jhalife</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/jhalife/?p=158</guid>
		<description><![CDATA[Today I was discussing with my friend Juampi Garcia who is writing a nice sample application that leverages the waz-storage gem and some other interesting things. While we were talking about his application, he asked me for some way of overriding the default connection for performing a bunch of operations as he needed it for [...]]]></description>
			<content:encoded><![CDATA[<p>Today I was discussing with my friend<a href="http://twitter.com/jpgd"> Juampi Garcia</a> who is writing a nice sample application that leverages the <em><a href="http://github.com/johnnyhalife/waz-storage">waz-storage gem</a></em> and some other interesting things. While we were talking about his application, he asked me for some way of overriding the default connection for performing a bunch of operations as he needed it for his application.</p>
<p>I started thinking and looking around some samples from DataMapper and other ORM frameworks that have the ability to override the current context by calling a method or specifying connection name. I looked deeply into it, but end up thinking that it will be better to have a little stack of connections in order to handle different contexts.</p>
<p>I end up writing a new method to WAZ::Storage::Base that enables you to scope your code to some specific context and once that context is left you get back to the default connection.</p>
<p>Consider the following sample in order to better understand what I did</p>
<pre style="font-size: 12px">
  WAZ::Storage::Base.establish_connection!(:account_name =&gt; 'name', :access_key =&gt; 'key')

  # any operation performed here will be on the default context expressed above. e.g.
  container = WAZ::Blobs::Container.find('my-container')

  # So, now let's suppose that I need to perform an operation on another context,
  # but those are just a few, and very scoped that isn't worth switching the whole
  # context to that. Leveraging the new method, I'll just do:
  WAZ::Storage::Base.establish_connection(:account_name =&gt; 'another', :access_key =&gt; 'key') do
     # any operation that I perform here, will be on this new context. e.g.
     another_container = WAZ::Blobs::Container.find('my-container')
     # Note that the operation above is performing a look-up of the container on another
     # storage account.
  end

  # Now that I've left the block, I'm back to my original context.
</pre>
<p>This new feature has been added to project at <a href="http://github.com/johnnyhalife/waz-storage">github.com/johnnyhalife/waz-storage</a> and the new documentation is also available at <a href="http://waz-storage.heroku.com">waz-storage.heroku.com</a>.</p>
<p>You can upgrade your gem, in order to have this new feature or just using the bleeding edge by cloning the repository on github (<strong>git://github.com/johnnyhalife/waz-storage.git</strong>)</p>
<h4>Another small change</h4>
<p>If you are (or tried) using <em>waz-storage</em> on Heroku.com without rails, you will realize that some exceptions about &#8216;String.start_with?&#8217; being undefined may appear. I&#8217;ve added an snippet to implement this method, on the rails way, when loading the waz gem (if it was previously undefined).</p>
<p>thanks,<br />
~johnny</p>
<img src="http://feeds.feedburner.com/~r/jhalife/~4/_dqmO7tSXZ0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/jhalife/2009/10/18/contextual-connection-handling-on-ruby-waz-storage/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.southworks.net/jhalife/2009/10/18/contextual-connection-handling-on-ruby-waz-storage/</feedburner:origLink></item>
		<item>
		<title>Announcing Ruby Windows Azure Storage SDK - v.0.5 !!!</title>
		<link>http://feeds.southworks.net/~r/jhalife/~3/2S-Aql5-b-A/</link>
		<comments>http://blogs.southworks.net/jhalife/2009/10/16/announcing-ruby-windows-azure-storage-sdk-v05/#comments</comments>
		<pubDate>Fri, 16 Oct 2009 21:02:11 +0000</pubDate>
		<dc:creator>jhalife</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/jhalife/?p=156</guid>
		<description><![CDATA[Hey, after talking, talking and talking about the possibilities of building a Windows Azure Storage SDK for Ruby, I finally got together a couple of ideas and develop the v.0.5. I&#8217;m still needing to write a decent sample application but now it has more resources that previous gems had.
For the project source code and pretty [...]]]></description>
			<content:encoded><![CDATA[<p>Hey, after talking, talking and talking about the possibilities of building a Windows Azure Storage SDK for Ruby, I finally got together a couple of ideas and develop the v.0.5. I&#8217;m still needing to write a decent sample application but now it has more resources that previous gems had.</p>
<p>For the <strong>project source code and pretty basic documentation</strong> go to <strong><a href="http://github.com/johnnyhalife/waz-storage">http://github.com/johnnyhalife/waz-storage</a></strong>.</p>
<p>For the whole <strong>API documentation</strong> refer to <strong><a href="http://waz-storage.heroku.com">http://waz-storage.heroku.com</a></strong>.</p>
<h2>What is Ruby Windows Azure Storage SDK (a.k.a waz-storage)?</h2>
<p>A simple implementation of Windows Azure Storage API for Ruby, inspired by the S3 gems and self experience of dealing with queues. The major goal of the whole gem is to enable ruby developers, like me =), to leverage Windows Azure Storage features and have another option for cloud storage.</p>
<p>The whole gem is implemented based on Microsoft’s specs from the communication and underlying service description and protocol (REST). The API is for Ruby developers built by a ruby developer. I’m trying to follow idioms, patterns and fluent type of doing APIs on Ruby.</p>
<p>This work isn’t related at all with StorageClient Sample shipped with Microsoft SDK and written in .NET, the whole API is based on my own understanding, experience and values of elegance and ruby development.</p>
<p>Full documentation for the gem is available at <a href="http://waz-storage.heroku.com">waz-storage.heroku.com</a></p>
<h2>Scenario Idea</h2>
<p>The gem was thought having <a href="http://heroku.com">heroku.com</a> in mind as it is my main Ruby hosting vendor. The basic idea can be expressed with the following diagram:</p>
<p><img src="http://files.me.com/johnny.halife/5j65mq" alt="Scenario Idea" /></p>
<p>As you can see there&#8217;s no need (and no personal desire) of hosting your application in Windows Azure or even writing it on .NET (or Windows needed at all).</p>
<h2>How does this differ from <em>waz-blobs</em> and <em>waz-queues</em>?</h2>
<p>Well, this is a sum up of the whole experience of writing those gems and getting them to work together to simplify end user experience. Although there’re some breaking changes, it’s pretty backward compatible with existing gems.</p>
<h2>Open Standards</h2>
<p>The <em>waz-storage</em> model is built upon the REST API published by Microsoft for Windows Azure Storage Services following the HTTP Standard. It&#8217;s basically a bunch of HTTP Requests with a special signature and some custom headers. The same API can be ported to any platform supporting a decent HTTP Stack.</p>
<h2>So, what?</h2>
<p>As in the latest posts, I won&#8217;t include too much detail here since it&#8217;s all explained at <a href="http://github.com/johnnyhalife/waz-storage">github.com/johnnyhalife/waz-storage</a> and the whole API is detailed (and documented) at <a href="http://waz-storage.heroku.com">waz-storage.heroku.com</a>.</p>
<p>The future is bright, I strongly appreciate all your feedback, your tweets and the time spent on (at least) reading the code. I really love this whole experience, but I won&#8217;t stop here, I&#8217;ll be relaxing from this SDK for a week or so (maybe less) until I come back for doing Tables support and fixing the issues that users may have encounter.</p>
<h3>TODOs&#8217;</h3>
<p>There should be some samples or at least one Reference Implementation of the API, probably I&#8217;ll be requesting help from other people in order to accomplish this, but I promise that some sample will be soon online so you can see the unveiled power of the Windows Azure Storage when running on Ruby.</p>
<p>Also there&#8217;s some support for Blocks that will be added, and some other sugar features for the application. </p>
<p>Time will tell, meanwhile you can comment, tweet or say whatever you want since I&#8217;ll be listening to your feedback.</p>
<h3>Acknowledgment</h3>
<p>This time I&#8217;ll make an special acknowledgment, besides my team, teammates, friends, and collegues at Southworks,  <a href="http://twitter.com/ezequielm">Ezequiel Morito</a> and <a href="http://twitter.com/jpdg">Juampi Garcia</a>. I want to thank and recognize that this work won&#8217;t be online today if I didn&#8217;t receive the advice from <a href="http://blogs.salias.com.ar">Martin Salias</a> who encouraged me to go further on spiking and publishing my spikes. </p>
<p>Thanks <a href="http://twitter.com/martinsalias">Martin</a>, I really appreciate your support and guidance.</p>
<img src="http://feeds.feedburner.com/~r/jhalife/~4/2S-Aql5-b-A" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/jhalife/2009/10/16/announcing-ruby-windows-azure-storage-sdk-v05/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.southworks.net/jhalife/2009/10/16/announcing-ruby-windows-azure-storage-sdk-v05/</feedburner:origLink></item>
		<item>
		<title>waz-queues + waz-blobs = Ruby WAZ Storage SDK (waz-storage)</title>
		<link>http://feeds.southworks.net/~r/jhalife/~3/jvyY888ikco/</link>
		<comments>http://blogs.southworks.net/jhalife/2009/10/14/waz-queues-waz-blobs-ruby-waz-storage-sdk-waz-storage/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 17:59:09 +0000</pubDate>
		<dc:creator>jhalife</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/jhalife/?p=153</guid>
		<description><![CDATA[Hey, after giving lots of thoughts of what am I going to do with the whole set of Ruby APIs for Windows Azure Storage, I figured out that might be better to have them merged, tested and refactored as a whole thing. I thought about lot&#8217;s of pro&#8217;s and con&#8217;s regarding whether to do this [...]]]></description>
			<content:encoded><![CDATA[<p>Hey, after giving lots of thoughts of what am I going to do with the whole set of Ruby APIs for Windows Azure Storage, I figured out that might be better to have them merged, tested and refactored as a whole thing. I thought about lot&#8217;s of pro&#8217;s and con&#8217;s regarding whether to do this or not and I came out with a the following list:</p>
<h3>Pro&#8217;s</h3>
<ul>
<li>Blobs and Queues handle the same type of security, connection and headers. They share the core service called WAZ::Storage::SharedKeyCoreService</li>
<li>While I was doing some work on Queues I found some bugs on connection management and URI management on the CoreService, so those changes weren&#8217;t propagated to Blobs (yet).</li>
<li>99% use case of the gem is that people handle a single WAZ Account for everything (Queues, Blobs and Tables) so have to connect, configure and consume them from different gems seems lot of overhead.</li>
<li>Maintainability Index really drops on having them split.</li>
<li>This is a single man&#8217;s work and even worse is doing over my spare time (so I cannot keep them both up-to-date always).</li>
<li>Total gem size is 50KB compared to two gems of 30KB (so storage isn&#8217;t a problem here)</li>
</ul>
<h3>Con&#8217;s</h3>
<ul>
<li>At some point seemed cool and very aligned with YAGNI that you need to install only what you need (queues or blobs)</li>
<li>Shared behavior could be inherited from a third gem called &#8216;waz-storage-core&#8217; but that will require more maintainability work.</li>
</ul>
<p>Those are the things that came to my mind while working on this, so I decided to glue them together, refactor them and generate a consisten API for both services (and the tables soon enough).</p>
<h2>Towards the SDK</h2>
<p>Ruby devs aren&#8217;t usually required to have SDKs that&#8217;s more of the Windows World. SDK is the name I decided the whole thing will have: documentation, sample, gems and source code (Yes! I&#8217;ll do more docs). I&#8217;m looking for a consumable way for Ruby Devs to get involved on Windows Azure (since it&#8217;s worth doing it) but also there&#8217;re a lot of .NET Developers that may want to have a look at Ruby&#8217;s features and opportunities outside Windows World.</p>
<h2>This is work in progress</h2>
<p><img class="alignright" style="float: right" src="http://files.me.com/johnny.halife/nu6rch" alt="Tests running together" width="355" height="204" /></p>
<p>Although I didn&#8217;t officially released anything related to this new SDK, I started my own work towards completing the API, <strong>so every piece of valuable feedback you might have will be really appreciated!</strong> I really enjoy while doing this and probably will do better as time goes by but as you can see on the pictures, I already started, merged and have a pretty decent TODO&#8217;s to apply to this thing and probably after that I&#8217;ll be releasing another version.</p>
<p>From the picture on the right you can infer, that I&#8217;ve already merged the test suite, and the TODO&#8217;s. The whole project is now a single thing. These are the things that I&#8217;m considering for next version</p>
<p><img src="http://files.me.com/johnny.halife/fd3y88" alt="TODO's" width="684" height="512" /></p>
<p>As you can see, there are things that still need to be figured out, but with time (no much) , they will emerge and I&#8217;ll be releasing as soon as I have them.</p>
<h2>Help wanted!</h2>
<p>As I mentioned now and on the previous posts, <strong>this is a one man&#8217;s work but you can change it =).</strong> I&#8217;m looking for Developers (juniors, amateurs, pro&#8217;s, whatever) to contribute on the project as they wish. If you want to test the code base, write a sample, write some docs, or whatever you&#8217;re invited! Drop me a message at <a href="http://twitter.com/johnnyhalife">@johnnyhalife</a> and we should get going soon.</p>
<p>that&#8217;s it, stay tuned for more! (very soon)</p>
<p>thanks,<br />
~johnny</p>
<img src="http://feeds.feedburner.com/~r/jhalife/~4/jvyY888ikco" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/jhalife/2009/10/14/waz-queues-waz-blobs-ruby-waz-storage-sdk-waz-storage/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.southworks.net/jhalife/2009/10/14/waz-queues-waz-blobs-ruby-waz-storage-sdk-waz-storage/</feedburner:origLink></item>
		<item>
		<title>Windows Azure Queues exposed directly to pure Ruby!</title>
		<link>http://feeds.southworks.net/~r/jhalife/~3/BceDt4eNNro/</link>
		<comments>http://blogs.southworks.net/jhalife/2009/10/09/windows-azure-queues-exposed-directly-to-pure-ruby/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 18:02:37 +0000</pubDate>
		<dc:creator>jhalife</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/jhalife/?p=152</guid>
		<description><![CDATA[Hey Pals! As you might recall two days ago I&#8217;ve published an API called &#8220;waz-blobs&#8221; that enabled Ruby Developers to get the best from Windows Azure storage straight from their pure ruby code. I told you I won&#8217;t stop there, so now I&#8217;m proud to announce that I&#8217;ve created waz-queues. As you can imagine and [...]]]></description>
			<content:encoded><![CDATA[<p>Hey Pals! As you might recall two days ago <a href="blogs.southworks.net/jhalife/2009/10/06/consuming-windows-azure-blob-storage-from-ruby/">I&#8217;ve published an API called &#8220;waz-blobs&#8221; that enabled Ruby Developers to get the best from Windows Azure storage</a> straight from their pure ruby code. I told you I won&#8217;t stop there, so now I&#8217;m proud to announce that I&#8217;ve created <a href="http://github.com/johnnyhalife/waz-queues/">waz-queues</a>. As you can imagine and given the fact that I wasn&#8217;t creative at the time I named this things (If I had a dog I&#8217;d name it dog), this API exposes Windows Azure Queues to Ruby Developers (and IronRuby Devs too!).</p>
<p>Like the previous API, it&#8217;s 100% pure ruby, relays on <a href="http://github.com/adamwiggins/rest-client/">RestClient written by Adam Wiggins</a> and was written and tested on Mac and Ubuntu.</p>
<p>As on the <a href="http://blogs.southworks.net/jhalife/2009/10/06/consuming-windows-azure-blob-storage-from-ruby/">previous post</a> I wrote about the Blobs API,  this post isn&#8217;t about API documentation. It&#8217;s about all those things that forced me to write the API and some other random thoughts about where this whole thing is going.</p>
<h2>Oh, you did it again!</h2>
<p>Yes! I love it, interoperability is my passion, I love to write things to demonstrate that they can work with other very different things, and given the fact that Microsoft did a great job when they <a href="http://msdn.microsoft.com/en-us/library/dd179363.aspx">published the Windows Azure Storage Queue API on line</a>, I decided I&#8217;ll spend some time building this. Queues are great, async programming is cool and REST is something that people do not believe until they see it (for those skeptical devs this is fully implemented over HTTP Stack on pure Ruby)</p>
<h2>There&#8217;s nothing worse than waiting inline. Bummer!</h2>
<p>Welcome to the twentieth one century, we live surrounded by the buzz and the current one is called &#8220;Cloud Computing&#8221;. Although I won&#8217;t discuss the topic here, it relays on a very simple principle <em>&#8220;pay-to-play&#8221;</em>. If you want to handle more requests just increase the number of workers and decrease the number of money you&#8217;ve got on your pockets.</p>
<p>Not all the operations on a System need to be always consistent, Amazon cart is an example of that. When you don&#8217;t want to pay more just get a queue, do some work async, and voila! your problems are solved.</p>
<p>Some hosting platforms like <a href="http://heroku.com">Heroku</a> o <a href="http://lx.azure.microsoft.com">Windows Azure</a> have a limited number of requests that they can handle with a single machine/worker/dyno/you_name_it, when the backlog becomes to big they start to deflect request with HTTP 500 messages. If you relay on a queue you will also have a way to increase responsiveness on your app, sites like <a href="http://digg.com">digg</a> and<a href="http://twitter.com"> twitter.com </a>already do something similar.</p>
<h2>Why do I need Azure Queues?</h2>
<p>It&#8217;s an extremely powerful alternative to having a File System Queue or archaic Queue Systems like MSMQ, it&#8217;s on the cloud, it&#8217;s unlimited storage growth and can be used from either your current hosting or Windows Azure.</p>
<p>The whole Queue Service provided by Windows Azure it&#8217;s really simple but not least powerful. Possibilities are endless, and you can do whatever you want and create a multi-party system that has your web app hosted on Heroku written in pure ruby, a back end service running on Windows Azure written on C# and a python app hosted on Google Apps engine that uses Windows Azure Queues to communicate with each other. There&#8217;s no limit! (Even your mainframe can handle WAZ-Queues with some C HTTP Lib + playing nice with sockets).</p>
<h2>Ok, I buy it, now show me your magic</h2>
<p>The API is pretty simple, simpler than anything I&#8217;ve written before. Here&#8217;s a snippet that illustrates basic API interaction (or in other words, everything you need from a queue)</p>
<h3>Getting started</h3>
<pre style="font-size: 16px;padding: 2px;color: #333">sudo gem install waz-queues --source http://gemcutter.org</pre>
<h3>Reference Code</h3>
<pre style="font-size: 12px;padding: 2px;color: #333;border: 1px solid">  require 'waz-queues'

        service = WAZ::Queues::Base.establish_connection!(:account_name =&gt; account_name,
                                                          :access_key =&gt; access_key)

        # excepts that the metadata for the queue changes this method behaves as PUT
        # remarks: it performs a validation whether metadata changed or not (HTTP 409 conflict)
        queue = WAZ::Queues::Queue.create('my-queue')

        10.times do |m|
          # enqueue a receives string. Message content can be anything up to 8KB
          # you can serialize and send anything that serializes to UTF-8 string (JSON, XML, etc)
          queue.enqueue!("message##{m}")
        end

        while(queue.size &gt; 0) do
          # Since WAZ implements the peek lock pattern we are locking messages (not dequeuing)
          # it has two parameters how many messages and for how long they are locked
          messages = queue.lock(10)

          puts "dequeued message: #{messages.size}"

          # deletes the message from the queue so other clients do not pick it after
          # visibility time out expires
          messages.each {|m| m.destroy!}
        end</pre>
<h2>What&#8217;s next</h2>
<p>While doing this I figured out that there&#8217;s a common behavior shared across blobs and queues, you can see it on the code that I started doing some merging while creating a ruby module called <strong>WAZ::Storage::SharedKeyCoreService</strong> that handles everything related to connections, requests, headers and signing messages. I&#8217;ll be merging the whole thing into &#8216;waz-storage&#8217; gem that I&#8217;m planning to start over the weekend and create a small reference application to illustrate better what does this do? (if you wanna join ping me via <a href="http://twitter.com/johnnyhalife">twitter @johnnnyhalife</a>)</p>
<p>That&#8217;s it, I won&#8217;t say I&#8217;ll do tables API too, I guess that after this week you can figure it out by yourselves (although it might take more time)</p>
<h3>Special Thanks</h3>
<p>I&#8217;d like to thank the following people that help me with something more important and painful than designing the API or writing the code that this time was an individual experiment. The following people are listening to me in every spare time I have at work, talking about why I design something like I did, how cool it is, or how do I enjoy this, which can be even hard than putting this code together!</p>
<p>These people are: <a href="http://blogs.southworks.net/mwoloski">Matias Woloski</a>, <a href="http://blogs.southworks.net/ejadib">Ezequiel Jadib</a>, <a href="http://blogs.southworks.net/fboerr">Federico Boerr</a>, <a href="http://twitter.com/ezequielm">Ezequiel Morito</a>, <a href="http://twitter.com/srenzi">Sebastian Renzi</a>, <a href="http://blog.salias.com.ar">Martín Salias</a> and Pablo Costantini.</p>
<p>That&#8217;s all folks. Thanks,<br />
~johnny</p>
<img src="http://feeds.feedburner.com/~r/jhalife/~4/BceDt4eNNro" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/jhalife/2009/10/09/windows-azure-queues-exposed-directly-to-pure-ruby/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.southworks.net/jhalife/2009/10/09/windows-azure-queues-exposed-directly-to-pure-ruby/</feedburner:origLink></item>
		<item>
		<title>Consuming Windows Azure Blob Storage from Ruby</title>
		<link>http://feeds.southworks.net/~r/jhalife/~3/TQ_FshjaHvg/</link>
		<comments>http://blogs.southworks.net/jhalife/2009/10/06/consuming-windows-azure-blob-storage-from-ruby/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 10:55:00 +0000</pubDate>
		<dc:creator>jhalife</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/jhalife/?p=151</guid>
		<description><![CDATA[Hey Folks, today I&#8217;m proud to announce my first release of the waz-blobs ruby gem, for interacting with Windows Azure Blob Storage from Ruby programming language.
Yes, it&#8217;s 100% organic Ruby code, there&#8217;s no strange Microsoft library that you need to consume and even better it was written and tested on Mac OS X and Ubuntu [...]]]></description>
			<content:encoded><![CDATA[<p>Hey Folks, today I&#8217;m proud to announce my first release of the <strong>waz-blobs</strong> <strong><a href="http://docs.rubygems.org/read/book/3">ruby gem</a></strong>, for interacting with <strong><a href="http://www.microsoft.com/azure/windowsazure.mspx">Windows Azure Blob Storage</a></strong><strong> </strong>from Ruby programming language.</p>
<p>Yes, it&#8217;s 100% organic Ruby code, there&#8217;s no strange Microsoft library that you need to consume and even better it was written and tested on Mac OS X and Ubuntu 8.10.  This post is about the motivation, and design process I&#8217;ve taken. Here you will find a minimal reference to the code, if you&#8217;re looking for the bits go straight to <a href="http://github.com/johnnyhalife/waz-blobs/">http://github.com/johnnyhalife/waz-blobs/</a> that includes the whole API documentation.</p>
<h2>Motivation</h2>
<p>Interoperability, fun and inspiration! Those three words are the base of this whole experience, from those OSS Fan thinking <em>&#8220;why would I go for Windows Azure Storage? I&#8217;ve have my App written 100% ruby and runs on my custom built linux distro!&#8221;</em>, here is the summary of the thinking I&#8217;ve been doing when I was trying to understand whether to write the API or not:</p>
<ul>
<li><strong>It&#8217;s solid. </strong>Although it&#8217;s on CTP, it has been out for almost a year and during the different version it has demonstrated some basic fundamentals covered on <em>Distributed Storage</em> and the speed it&#8217;s really good.</li>
</ul>
<ul>
<li><strong>Ruby&#8217;s alternatives for serving static files isn&#8217;t great.</strong> I love Ruby, it has slowly became the language of my preference on the last year, but we have to admit that serving static files it&#8217;s better when outside our Ruby App server.</li>
</ul>
<ul>
<li><strong>It&#8217;s interoperable. </strong>As I started this post, the code available at <a href="http://github.com/johnnyhalife/waz-blobs/">http://github.com/johnnyhalife/waz-blobs/</a> is <strong>100% organic ruby code</strong>, it&#8217;s <strong>based on the RestClient API written by Addam Wiggins</strong> from <a href="http://heroku.com">Heroku</a> that can be found on <a href="http://github.com/adamwiggins/rest-client">http://github.com/adamwiggins/rest-client</a>/. The code is based on the WAZ Rest API available at <a href="http://msdn.microsoft.com/en-us/library/dd135733.aspx">http://msdn.microsoft.com/en-us/library/dd135733.aspx</a></li>
</ul>
<ul>
<li><strong>It works great from Heroku. </strong>I spend my spare time hacking on pure Ruby and most of my project end up on <strong>Heroku (by far the best Ruby Hosting Platform on the Clouds).</strong> As you can see on<strong> <a href="http://docs.heroku.com">Heroku Docs</a></strong><strong>, </strong>their recommendation is to go for AWS-S3, and I don&#8217;t like when my choices are limited, I wrote the gem just to have an alternative for S3 when hosting on Heroku.</li>
</ul>
<div>I loved the experience, and I&#8217;m loving each moment I spend hacking on this code, it&#8217;s probably one of the most fun projects I&#8217;ve ever faced. As a .NET Developer, I figured out that even the Storage Client shipped with Azure SDK isn&#8217;t great (it&#8217;s not even fully implemented agains the API Spec), so instead of complaining I developed my own.</div>
<p></p>
<div>As summary: I did it<strong> for fun,</strong> I did it because<strong> I like having choices</strong> <strong>(not only S3)</strong> and because <strong>I wanted to see how real is Microsoft statement about interoperability for WAZ Services, </strong>which end up being completely true this time.</div>
<p></p>
<h2>Getting started with the <em>waz-blobs</em> API</h2>
<p>First of all, if you just want to use it just get it from the gems repository like the following:</p>
<pre style="font-size: 16px;padding: 2px;color: #333">gem install waz-blobs --source http://gemcutter.org</pre>
<p>And here&#8217;s some basics</p>
<pre style="font-size: 12px;padding: 2px;color: #333;border: 1px solid">
  require 'waz-blobs'

  # Save your configuration info
  WAZ::Blobs::Base.establish_connection!(:account_name =&gt; "name", :account_key =&gt; "key")

  # creates a container
  container = WAZ::Blobs::Container.create('my-container')

  # stores a blob with custom properties (metadata)
  blob = container.store('my-blob.txt',  'this is the content of my blob', 'plain/text')

  # return a specific blob from a container
  blob = container['my-blob.txt']

  # retrieves a blob value
  blob.value
</pre>
<p>The complete API reference and source code can be found at <a href="http://github.com/johnnyhalife/waz-blobs/">http://github.com/johnnyhalife/waz-blobs/</a>, feel free to download, fork it, and submit patches.<br />
</p>
<h2>Next Steps</h2>
<p>During the next days, I&#8217;ll continue using this and probably refactoring or bug fixing. In the near future (don&#8217;t know how quick yet), I&#8217;ll get the WAZ Queues API too.<br />
<br />
While I work on Queues,  <strong>fork me</strong> on GitHub and consider yourself invited to submit as many patches as you want.<br />
<br />
thanks and read you soon,<br />
~johnny</p>
<img src="http://feeds.feedburner.com/~r/jhalife/~4/TQ_FshjaHvg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/jhalife/2009/10/06/consuming-windows-azure-blob-storage-from-ruby/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.southworks.net/jhalife/2009/10/06/consuming-windows-azure-blob-storage-from-ruby/</feedburner:origLink></item>
	</channel>
</rss>
