Skip to content

Instantly share code, notes, and snippets.

View codingoutloud's full-sized avatar
💭
Building.

Bill Wilder codingoutloud

💭
Building.
View GitHub Profile
@codingoutloud
codingoutloud / PatientlyCreateBlobContainer.cs
Created July 16, 2012 01:36
Patiently create blob container; useful when container of same name was recently deleted (and full deletion may take a little time)
using Microsoft.WindowsAzure.StorageClient;
/// <summary>
/// Ensure that blobContainer exists before this method returns.
/// There is no timeout or maximum time for which this method can run.
/// </summary>
/// <param name="blobContainer">The (possibly not-yet-created) blob container.</param>
/// <param name="options">Required options for blob creation.</param>
/// <param name="retryDelay">Optional. Control how long to sleep between creation attempts.</param>
/// <returns>If success, just returns. Otherwise, exception is thrown.</returns>
@codingoutloud
codingoutloud / ByteArraySerializer.cs
Created July 16, 2012 00:06
Serialize/Deserialize an object for passing through Windows Azure Queue
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
// Alternative (not related to this code, but in case you want to serialize to XML
// instead): http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/5d08bc28-5b61-4c5a-8c4b-4665b1c929ea/
// Usage example
// NOTE: The Windows Azure CloudQueueMessage constructor accepts either a string
// or a byte array. If a byte array is passed in, it is Base64 encoded.
// Base64 encoding results in approx a 1/3 payload size penalty (so the