<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-4714159983058814272</atom:id><lastBuildDate>Fri, 30 Aug 2024 05:05:17 +0000</lastBuildDate><category>azure</category><category>Javascript</category><category>NuGet</category><category>debugging</category><category>instrumentation</category><category>tips</category><category>ASP.NET</category><category>JsTrace</category><category>Microsoft</category><category>Cache</category><category>MVC</category><category>publish</category><category>AppFabric</category><category>Authentication</category><category>Bundling</category><category>CSS</category><category>Extension</category><category>Facepalm</category><category>HTML</category><category>IE</category><category>IoC</category><category>Lumia</category><category>OutputCache</category><category>Patterns</category><category>SQL</category><category>ServiceBus</category><category>TFS</category><category>VirtualBox</category><category>Visual Studio</category><category>Windows 8</category><category>Zune</category><category>charity</category><category>errors</category><category>givecamp</category><category>globalization</category><category>msbuild</category><category>passwords</category><category>rants</category><category>resolution</category><category>scripts</category><category>touch</category><category>weinre</category><title>Codemares</title><description>Like nightmares, only codier!</description><link>http://codemares.blogspot.com/</link><managingEditor>noreply@blogger.com (Anonymous)</managingEditor><generator>Blogger</generator><openSearch:totalResults>30</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-2602679853283170536</guid><pubDate>Mon, 05 Nov 2012 15:19:00 +0000</pubDate><atom:updated>2012-11-05T10:19:57.518-05:00</atom:updated><title>Remote Desktop to Ubuntu in Azure</title><description>After having seen a question on the &quot;&lt;a href=&quot;http://connect.microsoft.com/&quot; target=&quot;_blank&quot;&gt;Connect&lt;/a&gt;&quot; site about this, I decided to write a quick blog post on how to set up Remote Desktop (RDP) in Azure for a Linux installation (Ubuntu in this case).&lt;br /&gt;
&lt;br /&gt;
After I wrote the post, &lt;a href=&quot;http://www.appliedis.com/&quot; target=&quot;_blank&quot;&gt;my employer&lt;/a&gt; decided to post it on their site, so go here to view the post:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://blog.appliedis.com/2012/11/05/remote-desktop-to-ubuntu-in-windows-azure/&quot; target=&quot;_blank&quot;&gt;Remote Desktop to Ubuntu in Windows Azure&lt;/a&gt;</description><link>http://codemares.blogspot.com/2012/11/remote-desktop-to-ubuntu-in-azure.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-3802221598082147044</guid><pubDate>Wed, 27 Jun 2012 15:00:00 +0000</pubDate><atom:updated>2012-06-27T11:00:43.792-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">azure</category><category domain="http://www.blogger.com/atom/ns#">scripts</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><category domain="http://www.blogger.com/atom/ns#">tips</category><title>Update Azure DB Firewall Rules with PowerShell</title><description>If you do Azure development and work from home like I do, you may find yourself repeatedly updating your SQL Azure Firewall settings to allow yourself to work with your database.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
This is especially true if your crappy ISP repeatedly disconnects you throughout the day and assigns you new IP addresses. I don&#39;t want to disparage any company in particular, but I really hope there&#39;s some bandwidth competition on the &lt;strong&gt;horizon&lt;/strong&gt;.&lt;br /&gt;
So, I wrote a PowerShell script to fix this problem.&amp;nbsp; Now, I just say do the following: &lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://lh4.ggpht.com/-53mLQI0Qt4U/T-sdzNXkDYI/AAAAAAAAG-Q/rpFI-JEoCpM/s1600-h/image%25255B4%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;233&quot; src=&quot;http://lh4.ggpht.com/-gs176XsQELs/T-sd0MZk_2I/AAAAAAAAG-Y/7r_O5Aoezj4/image_thumb%25255B2%25255D.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Notice, the script checks the current rule and then replaces it, if needed.&amp;nbsp; If it is not, it will say &quot;Current Rule Is Correct&quot;.&lt;br /&gt;
&lt;br /&gt;
In order to use this script, you will need to download and &quot;import&quot; the &lt;a href=&quot;http://wappowershell.codeplex.com/documentation&quot; target=&quot;_blank&quot;&gt;WAPPSCmdlets&lt;/a&gt; from CodePlex using &quot;Import-Module&quot;.&lt;br /&gt;
&lt;br /&gt;
You will also need to fill in the 4 variables at the top of the script. Note that the Certificate you use must be a &lt;strong&gt;Management&lt;/strong&gt; certificate that is installed into the Azure Portal.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:powershell&quot;&gt;#TODO: set these up as parameters (with defaults)
$ruleName = &#39;Rule Name&#39; #Whatever you want to see in the Azure UI for this Rule
$server = &#39;&#39; # the server name (without the &quot;.database.windows.net&quot; on the end)
$subId = &#39;&#39; # The Subscription ID
$cert = (Get-Item cert:\\CurrentUser\My\[YOUR KEY GOES HERE]) #the key is the &quot;Thumbprint&quot; - use &quot;dir cert:\CurrentUser\My&quot; to find yours

function RemoveRule()
{
    Write-Verbose &#39;Removing Firewall Rule&#39;
    Remove-SqlAzureFirewallRule -ServerName $server -RuleName $ruleName -SubscriptionId $subId -Certificate $cert | Format-Table
}

function AddRule($myIP)
{
    Write-Output &#39;Adding rule for IP: &#39; + $myIP
    New-SqlAzureFirewallRule -StartIpAddress $myIP -EndIpAddress $myIp -ServerName $server -RuleName $ruleName -SubscriptionId $subId -Certificate $cert | Format-Table
}

## Function to retrieve external IP address.
## the external address is retrieved from the
## title header of the webpage &quot;www.myip.dk&quot;

function Get-ExternalIP {
    $source = &quot;http://automation.whatismyip.com/n09230945.asp&quot;
    
    $client = new-object System.Net.WebClient
    
    #add the header that whatismyip.com suggests from (http://www.whatismyip.com/faq/automation.asp)
    $client.Headers.Add(&#39;user-agent&#39;, &#39;Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0&#39;)
    
    $client.downloadString($source)
}

function Update-AzureDBFirewallRules
{
    # get current IP.
    $currentIp = &amp;amp;Get-ExternalIP
    $rules = (Get-SqlAzureFirewallRules $server -SubscriptionId $subId -Certificate $cert)
    
    $curRule =  $rules | ? {$_.RuleName -eq $ruleName}
    
    $shouldAdd = $false

    if ($curRule -ne $null) {
        $ruleIp = $curRule.StartIpAddress
        if ($ruleIp -ne $currentIp ) {
        
            Write-Warning &quot;Current IP [$ruleIp] is incorrect, removing Rule&quot;
            &amp;amp;RemoveRule
            $shouldAdd = $true
        }
        else {
            Write-Output &#39;Current Rule is Correct&#39;
        }
    }

    if ($shouldAdd -eq $true)
    {
        &amp;amp;AddRule ($currentIp)
    }
}

&lt;/pre&gt;
Hope this helps some of you out there...</description><link>http://codemares.blogspot.com/2012/06/update-azure-db-firewall-rules-with.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/-gs176XsQELs/T-sd0MZk_2I/AAAAAAAAG-Y/7r_O5Aoezj4/s72-c/image_thumb%25255B2%25255D.png?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-2553724652138811452</guid><pubDate>Thu, 17 May 2012 11:18:00 +0000</pubDate><atom:updated>2012-05-17T09:45:39.906-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">azure</category><category domain="http://www.blogger.com/atom/ns#">tips</category><title>Developing for, but remaining decoupled from Azure</title><description>(This started out as a &lt;a href=&quot;http://yammer.com/&quot; target=&quot;_blank&quot;&gt;Yammer&lt;/a&gt; discussion post, but got obviously way too long for that, so I decided to blog it instead.)&lt;br /&gt;
&lt;br /&gt;
A coworker had mentioned that there could be difficulty in developing for Azure while maintaining independence from it by decoupling from direct dependencies. &amp;nbsp;Having done this from the beginning in my almost 2-year old Azure project, I decided to tell how I did this.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;


Why decouple?&lt;/h3&gt;
&lt;br /&gt;
First of all, why do we need to do this?&lt;br /&gt;
&lt;br /&gt;
Well, I have developed for a very wide range of platforms in my past, including dozens of flavors of *nix, tons of versions of Windows (3.0, 3.1, 3.11, 95, 98, 98 SE, NT 3.X, 2000, ME, XP, Vista, Win 7), QNX, PSOS, OS/2, Mac OS, etc.&lt;br /&gt;
&lt;br /&gt;
Given that, I&#39;ve always had issues with tying my code too tightly to a platform. &amp;nbsp;It always seems to come back and bit you. Hard.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;



Developing/Debugging&lt;/h3&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
If you have ever tried to develop and debug with the Azure Dev Fabric, you probably didn&#39;t even ask this question in the first place. &lt;br /&gt;
&lt;br /&gt;
Working with the Dev Fabric is painful, especially in the Web development side. &amp;nbsp;Instead of being able to edit the HTML and JavaScript files while you debug, each edit requires a rebuild and redeploy.&lt;br /&gt;
&lt;br /&gt;
If you&#39;re not familiar with this process, what is actually happening when you debug a &quot;Cloud&quot; app is a full deployment. &amp;nbsp;Visual Studio is compiling the code, then, upon success, it packages a mini-azure deployment and deploys it to the Dev Fabric. &amp;nbsp;This involves spinning up temporary Web Sites on your IIS installation and spinning up what are effectively mini Virtual Machines. &amp;nbsp;So, in order to get any code changes over there, you must redeploy.&lt;br /&gt;
&lt;br /&gt;
Bottom Line: no easy tweaks to your HTML, CSS or JavaScript while debugging.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;



Platform Independence&lt;/h3&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Sometimes, you may not have 100% buy-in from a client or a manager for running in Azure, so, in order to hedge your bets, you need to have the &lt;i&gt;ability&lt;/i&gt;&amp;nbsp;to run on Azure without depending on it, in case someone makes a decision to go the other way. &amp;nbsp;Maybe the client hires a new CIO and he wants to run on Amazon because Jeff Bezos is an old college buddy. &amp;nbsp;Crazier things have happened.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
In my case, my project was, I believe, the first Azure project &lt;a href=&quot;http://www.appliedis.com/&quot; target=&quot;_blank&quot;&gt;our company&lt;/a&gt; deployed into Production. &amp;nbsp; Thus, we were hedging our bets a bit by allowing it to run on a regular on-premise deployment. &amp;nbsp;This had the added benefit of allowing us to do pilot/demo deployments on-site for our client so they could view the site during early development.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;


What to decouple?&lt;/h3&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
First off, there are three main areas that need to be decoupled in order to maintain your freedom, Configuration Settings, Images/Static Files and Data (SQL, etc)&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;






CONFIGURATION SETTINGS&lt;/h4&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Regular .NET apps use AppSettings from either web.config or app.config for simple key/value settings. &amp;nbsp;For this scenario, a simple interface will do:&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class=&quot;brush:csharp&quot;&gt;public interface IConfigurationSettingsProvider
{
    string GetSettingValue(string key);
}&lt;/pre&gt;
&lt;b&gt;
Non-Azure Implementation&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;brush:csharp&quot;&gt;using System.Configuration;

public class ConfigurationManagerSettingsProvider
    : IConfigurationSettingsProvider
{
    public string GetSettingValue(string key)
    {
        return ConfigurationManager.AppSettings.Get(key);
    }
}&lt;/pre&gt;
&lt;b&gt;
Azure Implementation&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;brush:csharp&quot;&gt;public class AzureRoleConfigurationSettingsProvider
    : IConfigurationSettingsProvider
{
    public string GetSettingValue(string key)
    {
        return RoleEnvironment.GetConfigurationSettingValue(key);
    }
}
&lt;/pre&gt;
As you see, this isn&#39;t really all that complicated&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;





IMAGES&lt;/h4&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
In my case, the images we&#39;re serving up generally are based on an &quot;Item Key&quot; and can either be referring to a &quot;normal&quot; image size or a &quot;thumbnail&quot; image. &amp;nbsp;We also needed the ability to store the images and retrieve them. &lt;br /&gt;
&lt;br /&gt;
The implementation of my IImageStorage interface also actually takes care of scaling the images to the appropriate sizes during upload.&lt;br /&gt;
&lt;br /&gt;
The particulars of your situation may vary, but the pattern could be similar.&lt;br /&gt;
NOTE: I removed a few overloads of methods here (for instance, each &quot;Save&quot; method has an implementation that takes a &quot;Stream&quot; and proxies it to the byte[] after reading the Stream in)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;

Interface&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;brush:csharp&quot;&gt;public enum ImageSize
{
    Thumbnail,
    Normal,
    Original
}
 
public interface IImageStorage 
{ 
    void SaveImage(int imageId, string pathInfo, byte[] imageBytes); 
 
    // removed overloads 
    // ... 
 
    Uri GetImageUri(int imageId, ImageSize size); 
 
    IEnumerable&amp;lt;int&amp;gt; GetAllImageIds();
 
    void DeleteImage(int imageId); 
} &lt;/pre&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;b&gt;

Non-Azure Implementation&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
In this case, I chose to make a &quot;FileSystemImageStorage&quot; class that uses a directory structure of&lt;br /&gt;
&lt;br /&gt;
Root-&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Thumbs&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Normal&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Original&lt;br /&gt;
&lt;br /&gt;
Each file name is the &quot;ID&quot; with &quot;.jpg&quot; in the end. &lt;br /&gt;
&lt;br /&gt;
The urls returned are either &quot;file:///&quot; or &quot;data://&quot; (base64-encoded) urls based on the size.&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;b&gt;



Azure Implementation&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
For Azure, the pattern is very similar. &amp;nbsp;I created a &quot;BlobStorageImageStorage&quot; class. &amp;nbsp;I use 3 Blob Storage Containers called &quot;normal&quot;, &quot;thumbs&quot; and &quot;original&quot; which each contain a blob with the image inside it. &lt;br /&gt;
&lt;br /&gt;
In this case, I chose to make the name the ID zero-padded to 10 spaces in order to allow for long-term expansion. &amp;nbsp;So, ID 1234 would be &quot;0000001234&quot;. &amp;nbsp;So, my url for the thumbnail for 1234 is:&lt;br /&gt;
&lt;br /&gt;
http:// [accountname].blob.storage.net/thumbs/0000001234&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;





DATA&lt;/h4&gt;
&lt;div&gt;
&lt;br /&gt;
For a &quot;typical&quot; application, data usually means SQL. &amp;nbsp;In the case of SQL, the only difference as far as your application is concerned is a connection string, which is easy enough to abstract for yourself.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
If, on the other hand, you are using Azure Table Storage, you will need to have some sort of Repository interface that will persist TableStorageEntitites for you.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
In our application, we decided to allow the Entities to subclass TableStorageEntity, regardless of whether or not we&#39;re storing them to Azure.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Given that, we have this class (keep in mind that I&#39;ve removed error checking, comments and a few other minor details - and the code patterning is kinda strange too in this format):&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class=&quot;brush:csharp&quot;&gt;public class TableServiceEntityRepository&amp;lt;TEntity&amp;gt;
    where TEntity : TableServiceEntity
{
    readonly string _tableName;
    readonly TableServiceContext _context; 
    public TableServiceEntityRepository(
        ITableServiceContextFactory ctxFactory)
    {
        _tableName = typeof(TEntity).Name;
        _context = ctxFactory.Create(_tableName);
    }
    public IQueryable&amp;lt;TEntity&amp;gt; Get(
        Specification&amp;lt;TEntity&amp;gt; whereClause = null,
        Func&amp;lt;
        &amp;lt;TEntity&amp;gt;, IOrderedQueryable&amp;lt;TEntity&amp;gt;
            &amp;gt; orderBy = null)
    {
        IQueryable&amp;lt;TEntity&amp;gt; query =
            _context.CreateQuery&amp;lt;TEntity&amp;gt;(_tableName);
        if (whereClause != null)
        {
            query = query.Where(whereClause.IsSatisfiedBy());
        }
        if (orderBy != null)
        {
            return orderBy(query);
        }
        return query;
    }
    public virtual void Insert(TEntity entity)
    {
        _context.AddObject(_tableName, entity);
    }
    public virtual void Update(TEntity entity)
    {
        var desc = _context.GetEntityDescriptor(entity);
        if (desc == null || desc.State == EntityStates.Detached)
        {
            _context.AttachTo(_tableName, entity, &quot;*&quot;);
        }
        _context.UpdateObject(entity);
    }
    public virtual void Delete(TEntity entity)
    {
        var desc = _context.GetEntityDescriptor(entity);
        if (desc == null || desc.State == EntityStates.Detached)
        {
            _context.AttachTo(_tableName, entity, &quot;*&quot;);
        }
        _context.DeleteObject(entity);
    }
    public virtual void SaveChanges()
    {
        _context.SaveChanges();
    }
}
&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;
If you notice, this code uses a Specification&lt;tentity&gt; for a &quot;whereClause&quot;. &amp;nbsp;That is defined this way:&amp;nbsp;&lt;/tentity&gt;&lt;br /&gt;
&lt;tentity&gt;&lt;br /&gt;&lt;/tentity&gt;&lt;/div&gt;
&lt;pre class=&quot;brush:csharp&quot;&gt;public abstract class Specification&amp;lt;TEntity&amp;gt;
{ 
    private Func&amp;lt;TEntity, bool&amp;gt; _compiledFunc = null; 
    private Func&amp;lt;TEntity, bool&amp;gt; CompiledFunc 
    { 
        get 
        { 
            if (_compiledFunc == null) 
                _compiledFunc = this.IsSatisfiedBy().Compile(); 
            return _compiledFunc; 
        } 
    } 
    public abstract Expression&amp;lt;Func&amp;lt;TEntity, bool&amp;gt;&amp;gt; IsSatisfiedBy();
 
    public bool IsSatisfiedBy(TEntity entity) 
    { 
        return this.CompiledFunc(entity); 
    } 
} 
&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;
The non-Azure version of this just uses the TableServiceEntity&#39;s PartitionKey and RowKey fields for folder name and file name and uses Binary Serialization to serialize the files. &amp;nbsp;It&#39;s pretty simple, but wouldn&#39;t work for very large numbers of entities, of course. &amp;nbsp;You could, however choose to do the same thing with SQL Server using a SQL Blob for the serialized data for a quick speed improvement.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
Though we have other implementation abstractions in our software for things like Queues, this should give you a good kick start on how things are done.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;





Summary&lt;/h3&gt;
&lt;div&gt;
&lt;br /&gt;
Abstracting things from specific hardware/platform dependencies is usually a Good Thing in my opinion. &amp;nbsp;Stuff Happens. &amp;nbsp;Platforms break/die/become uncool, etc. &amp;nbsp;We shouldn&#39;t have to refactor significant portions of applications in order to be more Platform agnostic.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Feel free to comment or contact me for more details on how things like this can be done, or any questions on my implementation of the Specification pattern or anything at all :)&lt;/div&gt;</description><link>http://codemares.blogspot.com/2012/05/developing-for-but-remaining-decoupled.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-7233910831108683460</guid><pubDate>Fri, 20 Apr 2012 14:34:00 +0000</pubDate><atom:updated>2012-04-20T10:34:47.366-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Facepalm</category><category domain="http://www.blogger.com/atom/ns#">Lumia</category><category domain="http://www.blogger.com/atom/ns#">Microsoft</category><category domain="http://www.blogger.com/atom/ns#">Zune</category><title>Solution to 0x80007002 error installing Zune 4.8</title><description>&lt;br /&gt;
I just bought a Nokia Lumia 900 only to find that &lt;a href=&quot;http://www.microsoft.com/&quot;&gt;Microsoft&lt;/a&gt; took a page from &lt;a href=&quot;http://www.apple.com/&quot;&gt;Apple&lt;/a&gt;&#39;s book and required the installation if iTunes Zune software in order to upgrade the phone.  Ugh!&lt;br /&gt;
&lt;br /&gt;
So, I download the installer and, of course, get 0x80007002 error installing the software.  It tells me: &lt;br /&gt;
&lt;blockquote&gt;
&lt;i&gt;The media for installation package couldn&#39;t be found. It might be incomplete or corrupt
&lt;/i&gt;&lt;/blockquote&gt;
Uh… What?  It&#39;s a Self-Extracting EXE!&lt;br /&gt;
&lt;br /&gt;
Here&#39;s what I tried: &lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Download the &quot;full version&quot; (first one downloaded the installer to temp files) –&amp;nbsp;
&lt;b&gt;FAIL&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Ran a Microsoft &quot;FixIt&quot; app that was supposed to .. you know.. Fix It? –&amp;nbsp;
&lt;b&gt;FAIL&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Turned off the Firewall –&amp;nbsp;
&lt;b&gt;FAIL&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Yelled at the Screen –&amp;nbsp;
&lt;b&gt;FAIL&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&quot;Unblocked&quot; the EXE file and re-ran the installer –&amp;nbsp;&amp;nbsp;&lt;b&gt;FAIL&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Decided to get insanely stupid and unzipped the file myself and ran the contained installer – &lt;b&gt;Success!? (*facepalm*)&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;u&gt;Whiskey. Tango. Foxtrot?&amp;nbsp;&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
Apparently their &quot;self-extracting&quot; EXE is not very good at the job. Can&#39;t blame them, since self-extracting zip files is a really recent innova--- Wait! That technology has existed for decades!!&lt;br /&gt;
&lt;br /&gt;
Come on guys! Maybe you need a refresher course!&lt;br /&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;(&quot;It&#39;s all ball bearings nowadays!&quot;)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
So.. if you run into this, just unzip the thing your damned self and call it a day!</description><link>http://codemares.blogspot.com/2012/04/solution-to-0x80007002-error-installing.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-8805052496938277795</guid><pubDate>Sun, 18 Mar 2012 13:22:00 +0000</pubDate><atom:updated>2012-03-18T09:22:34.696-04:00</atom:updated><title>JsTrace 1.3 Released</title><description>Get it while it&#39;s hot!&lt;br /&gt;
&lt;br /&gt;
I just added a few features to the &lt;a href=&quot;http://jstrace.codeplex.com/&quot; target=&quot;_blank&quot;&gt;JsTrace&lt;/a&gt; code:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;New passthrough methods on the Trace object for the following:&amp;nbsp;assert, clear, count, dir, dirxml, exception, group, groupCollapsed, groupEnd, profile, profileEnd, table, time, timeEnd, trace&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Note that the Trace script does nothing but pass these through if they exist&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Ability to get/set the default trace level with the Trace.defaultTraceLevel method&lt;/li&gt;
&lt;li&gt;Ability to reset some or all of the currently configured trace levels to the defaults by calling the Trace.resetToDefault method.&lt;/li&gt;
&lt;li&gt;New &lt;a href=&quot;http://pivotal.github.com/jasmine&quot;&gt;Jasmine &lt;/a&gt;tests to make sure it works (mostly)&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
On the MVC side, I added a feature to the JsTrace.MVC package:&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;The ability to force logging to the server to be synchronous in order to preserve the order of messages coming back to the server.&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;It was either that or adding message numbers, and this was quicker.&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;div&gt;
NuGet packages are updated:&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;http://nuget.org/packages/jstrace&quot;&gt;http://nuget.org/packages/jstrace&lt;/a&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;http://nuget.org/packages/jstrace.mvc&quot;&gt;http://nuget.org/packages/jstrace.mvc&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Or browse the code here:&amp;nbsp;&lt;a href=&quot;http://jstrace.codeplex.com/&quot;&gt;http://jstrace.codeplex.com/&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Happy debugging!&lt;/div&gt;</description><link>http://codemares.blogspot.com/2012/03/jstrace-13-released.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-775589801687788933</guid><pubDate>Sat, 17 Mar 2012 20:33:00 +0000</pubDate><atom:updated>2012-03-18T07:11:34.665-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Bundling</category><category domain="http://www.blogger.com/atom/ns#">MVC</category><category domain="http://www.blogger.com/atom/ns#">NuGet</category><title>Disable Minification with MVC 4 Bundles</title><description>I decided to play around with a bunch of new technologies to dive in and learn today. I decided to write a basic blog app (yeah, boring, I know) using the following tools:
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.microsoft.com/visualstudio/11/en-us&quot; target=&quot;_blank&quot;&gt;Visual Studio 11 Beta &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.asp.net/mvc/mvc4&quot; target=&quot;_blank&quot;&gt;ASP.NET MVC 4 Beta&lt;/a&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.asp.net/single-page-application&quot; target=&quot;_blank&quot;&gt;Single Page Application&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.asp.net/vnext/overview/whitepapers/whats-new#_Toc318097384&quot; target=&quot;_blank&quot;&gt;Bundles &lt;/a&gt;(new combining/minification stuff)&lt;/li&gt;
&lt;li&gt;Web API&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;a href=&quot;http://twitter.github.com/bootstrap&quot; target=&quot;_blank&quot;&gt;Twitter Bootstrap 2.0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Modernizr&lt;/li&gt;
&lt;li&gt;MvcScaffolding&lt;/li&gt;
&lt;li&gt;etc…&lt;/li&gt;
&lt;/ul&gt;
&amp;nbsp; &amp;nbsp; (&lt;a href=&quot;http://bundling.codeplex.com/&quot; target=&quot;_blank&quot; title=&quot;Bundling Tweaks Project on CodePlex&quot;&gt;&lt;strong&gt;TL;DR? Click Here&lt;/strong&gt;&lt;/a&gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;
The Problems&lt;/h2&gt;
Everything was going well, adding &lt;a href=&quot;http://nuget.org/&quot;&gt;NuGet&lt;/a&gt; packages left and right (click, click, click!)&lt;br /&gt;
I added my &lt;a href=&quot;http://jstrace.codeplex.com/&quot; rel=&quot;contributor-to&quot; target=&quot;_blank&quot;&gt;JsTrace&lt;/a&gt; MVC NuGet package and started to get JavaScript errors.It turns out that I had 2 problems with the Bundles feature:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;It doesn&#39;t add anything to the Bundles automatically except the original scripts in the Template. &lt;/li&gt;
&lt;li&gt;It automatically uses minified files by looking for &quot;min&quot; or not &quot;debug&quot; JavaScript or CSS files. &lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;






Fix #1 - Add my own Bundles&lt;/h3&gt;
Grr!&amp;nbsp; To fix #1, I had to add my own Bundle to the Global.asax:&lt;br /&gt;
&lt;pre class=&quot;brush:csharp&quot;&gt;Bundle tomsBundle = new Bundle(&quot;~/core/js&quot;);
tomsBundle.AddDirectory(&quot;~/Scripts&quot;, &quot;Trace*&quot;, false, true);
tomsBundle.AddDirectory(&quot;~/Scripts/Core&quot;, &quot;Foo.*&quot;, false, true);
BundleTable.Bundles.Add(tomsBundle);&lt;/pre&gt;
OK, problem solved.&lt;br /&gt;
&lt;h4&gt;





Fix #1a - Bootstrap Bundles&lt;/h4&gt;
While I was there, I decided to make an extension method to add the &lt;a href=&quot;https://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;ved=0CCYQFjAA&amp;amp;url=https%3A%2F%2Fnuget.org%2Fpackages%2FTwitter.Bootstrap&amp;amp;ei=vOpkT83mMaHh0wGO3tGyCA&amp;amp;usg=AFQjCNGkOOHoQoSokgq5dIzLoXs08v5Wqg&amp;amp;sig2=oNgIsT8QyekE3O3PfvbEkA&quot; target=&quot;_blank&quot;&gt;Twitter.Bootstrap&lt;/a&gt; stuff to the BundleTable:&lt;br /&gt;
&lt;pre class=&quot;brush:csharp&quot;&gt;public static class BootstrapExtensionMethods
{
    public static void EnableBootstrapBundle(
        this BundleCollection bundles)
    {
        var bootstrapCss = new Bundle(&quot;~/bootstrap/css&quot;, 
            new CssMinify());
        bootstrapCss.AddDirectory(&quot;~/Content&quot;, &quot;bootstrap*&quot;, 
            false, true);
        bundles.Add(bootstrapCss);
 
        var bootstrapJs = new Bundle(&quot;~/bootstrap/js&quot;, new JsMinify());
        bootstrapJs.AddFile(&quot;~/Scripts/bootstrap.js&quot;);
        bundles.Add(bootstrapJs);
    }
}
&lt;/pre&gt;
So, add a one-liner to the Global.asax:
&lt;br /&gt;
&lt;pre class=&quot;brush:csharp&quot;&gt;BundleTable.Bundles.EnableBootstrapBundle();&lt;/pre&gt;
&lt;h3&gt;




Fix #2 - Supersize Me!&lt;/h3&gt;
Now, for Problem #2 – I want to have big, fat un-minimized debug versions of my files while I&#39;m developing.&lt;a href=&quot;http://lh3.ggpht.com/-Btof-vnlUIo/T2TwMKaCQaI/AAAAAAAAGZ0/BjSo8UW4QKM/s1600-h/ILSpy_JsMinify%25255B4%25255D.png&quot;&gt;&lt;img align=&quot;right&quot; alt=&quot;ILSpy_JsMinify&quot; border=&quot;0&quot; height=&quot;173&quot; src=&quot;http://lh5.ggpht.com/-V2QjGGM-6rM/T2TwMoCWk-I/AAAAAAAAGZ8/0TzCyMdPmKs/ILSpy_JsMinify_thumb%25255B2%25255D.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; float: right; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;ILSpy_JsMinify&quot; width=&quot;244&quot; /&gt;&lt;/a&gt;
So, after digging around with Google and ILSpy, I came across the implementation of JsMinify and noticed that it uses a property called &quot;EnableInstrumentation&quot; to determine whether or not it should minify the files. &lt;b&gt;Eureka!
&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Of course, they don&#39;t actually provide you with a simple way to set that flag. So, I realized I had to create my own implementation of 2 interfaces:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;IBundleBuilder&lt;/b&gt; - has the responsibility for iterating over a collection of files and combining them&lt;/li&gt;
&lt;li&gt;&lt;b&gt;IBundleTransform&lt;/b&gt; – has the responsibility of &quot;transforming&quot; (i.e. minifying) the bundles (default implementations being JsMinify and CssMinify)&lt;/li&gt;
&lt;/ul&gt;
So, I created two wrapper classes (basically, the Decorator Pattern):
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;NonMinifyingBundleBuilder &lt;/b&gt;– reverses Microsoft&#39;s logic and replaces the minified files with their debug counterparts.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;InstrumentedBundleTransform &lt;/b&gt;– sets the &quot;EnableInstrumentation&quot; flag to true while processing.&lt;/li&gt;
&lt;/ul&gt;
I then added a simple extension method to override everything in the BundleTable:&lt;br /&gt;
&lt;pre class=&quot;brush:csharp&quot;&gt;BundleTable.Bundles.DisableMinify();&lt;/pre&gt;
This is probably best wrapped in an &quot;#if DEBUG&quot; so your release code still gets all minified. &lt;br /&gt;
In fact, that&#39;s what I do in the &lt;a href=&quot;https://nuget.org/packages/McKearney.BundlingTweaks/&quot; target=&quot;_blank&quot; title=&quot;Bundling Tweaks NuGet Package&quot;&gt;NuGet package&lt;/a&gt; I created out of this!&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;NOTE:&lt;/b&gt; this is a &lt;b&gt;beta &lt;/b&gt;(since it relies on Microsoft.Web.Optimization 1.0.0-beta), so you will have to install the NuGet package with the NuGet Package Console like this:&lt;br /&gt;
&lt;blockquote&gt;
&lt;code style=&quot;-moz-border-radius: 5px; -webkit-border-radius: 5px; background-color: #202020; border-radius: 5px; border: 4px solid #c0c0c0; box-shadow: 2px 2px 3px #6e6e6e; color: #e2e2e2; display: block; font: 1em &#39;andale mono&#39;, &#39;lucida console&#39;, monospace; line-height: 1em; overflow: auto; padding: 15px;&quot;&gt;PM&amp;gt; Install-Package McKearney.BundlingTweaks
 -Pre &lt;/code&gt;&lt;/blockquote&gt;</description><link>http://codemares.blogspot.com/2012/03/disable-minification-with-mvc-4-bundles.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/-V2QjGGM-6rM/T2TwMoCWk-I/AAAAAAAAGZ8/0TzCyMdPmKs/s72-c/ILSpy_JsMinify_thumb%25255B2%25255D.png?imgmax=800" height="72" width="72"/><thr:total>8</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-1441372399054441931</guid><pubDate>Thu, 15 Mar 2012 12:28:00 +0000</pubDate><atom:updated>2012-03-15T08:29:44.934-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">azure</category><category domain="http://www.blogger.com/atom/ns#">publish</category><category domain="http://www.blogger.com/atom/ns#">tips</category><title>How To: Download Azure Publish Settings File</title><description>So, as of Azure SDK 1.6 (I think), Microsoft added the ability to import your publishing settings for Azure into Visual Studio to make deployments easier&lt;br /&gt;
&lt;a href=&quot;http://lh4.ggpht.com/-Qod5Gz-_Y9Q/T2HgdRJBJUI/AAAAAAAAGZY/jrzCRVOUkrY/s1600-h/image%25255B3%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;150&quot; src=&quot;http://lh5.ggpht.com/-DFvwmpiptes/T2Hgecj6-dI/AAAAAAAAGZg/bymHJFFfT24/image_thumb%25255B1%25255D.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom-color: initial; border-bottom-style: initial; border-bottom-width: 0px; border-left-color: initial; border-left-style: initial; border-left-width: 0px; border-right-color: initial; border-right-style: initial; border-right-width: 0px; border-top-color: initial; border-top-style: initial; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
This then launches your browser and has you login to your Live account.&lt;br /&gt;
Then, it downloads the file automatically and imports it, saving you time.&lt;br /&gt;
I installed &lt;a href=&quot;http://www.cerebrata.com/products/AzureDiagnosticsManager/&quot; target=&quot;_blank&quot; title=&quot;Visit the Azure Diagnostics Manager site&quot;&gt;Azure Diagnostics Manager&lt;/a&gt; Version 2 and it has a neat feature to allow you to import a Publish Settings File.&amp;nbsp; So, off I went to try to download it.&amp;nbsp; I found NO documentation on how to get it.&lt;br /&gt;
By some spelunking through browser history, I found this magical link:&lt;br /&gt;
&lt;blockquote&gt;
&lt;a href=&quot;https://windows.azure.com/download/publishprofile.aspx&quot; title=&quot;https://windows.azure.com/download/publishprofile.aspx&quot;&gt;https://windows.azure.com/download/publishprofile.aspx&lt;/a&gt;&lt;/blockquote&gt;
This will allow you to download the file and do whatever you want with it, including import it into ADM.&lt;br /&gt;
WARNING: This has sensitive information in it to allow you to publish to your Azure account.&amp;nbsp; I recommend you delete this file after you import it into ADM</description><link>http://codemares.blogspot.com/2012/03/how-to-download-azure-publish-settings.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/-DFvwmpiptes/T2Hgecj6-dI/AAAAAAAAGZg/bymHJFFfT24/s72-c/image_thumb%25255B1%25255D.png?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-889374541566403215</guid><pubDate>Sun, 11 Mar 2012 13:20:00 +0000</pubDate><atom:updated>2012-03-11T09:25:58.990-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">resolution</category><category domain="http://www.blogger.com/atom/ns#">VirtualBox</category><category domain="http://www.blogger.com/atom/ns#">Windows 8</category><title>Quick Tip: VirtualBox Win 8 Custom Resolution</title><description>&lt;p&gt;&lt;a href=&quot;http://lh5.ggpht.com/-KOFXMRFaU4k/T1yn3rlinhI/AAAAAAAAGXs/sG9midtNeog/s1600-h/image%25255B9%25255D.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; margin: 24px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;Lame Resolution Options&quot; border=&quot;0&quot; alt=&quot;1680x1050, 1600x1200, 1280x1024, 1152x864, 1024x768, 800x600&quot; align=&quot;right&quot; src=&quot;http://lh3.ggpht.com/-z5d9ApsvCfM/T1yn4CDi6tI/AAAAAAAAGX0/L82BTCYyDvM/image_thumb%25255B5%25255D.png?imgmax=800&quot; width=&quot;195&quot; height=&quot;235&quot;&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;I&#39;m not sure what the true root cause of the problem is, but, when running Windows 8 Customer Preview in VirtualBox, the set of allowed resolutions is pretty pathetic.&lt;/p&gt; &lt;p&gt;I don&#39;t even know where / why anyone would buy a 4:3 ratio monitor anymore, so I don&#39;t know why there aren&#39;t a bunch of supported 16:9 options in here.&lt;/p&gt; &lt;p&gt;In order to get around this, there&#39;s a command that, though simple, needs to be done from the command line (after shutting down your virtual machine)&lt;/p&gt; &lt;p&gt;So, if you go to your Virtual Box Folder (usually C:\Program Files\Oracle\VirtualBox) and run the following command, you should be OK:&lt;/p&gt;&lt;a href=&quot;http://lh3.ggpht.com/-Fo-Mqq4M9fU/T1yn4nCEGGI/AAAAAAAAGX4/KqB-9AcoHMU/s1600-h/image%25255B7%25255D.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;http://lh3.ggpht.com/-5rxdDE5ThuM/T1yn5NWmjWI/AAAAAAAAGYA/CQfxNPXspPI/image_thumb%25255B3%25255D.png?imgmax=800&quot; width=&quot;644&quot; height=&quot;49&quot;&gt;&lt;/a&gt; &lt;p&gt;Then, when you go back into your machine, you should see the new resolution listed for use.&lt;/p&gt; &lt;p&gt;I&#39;m not sure how to make this resolution available in every subsequent virtual machine, but I&#39;m glad it&#39;s available in this one.&lt;/p&gt; &lt;p&gt;Thanks to Dustin over at &lt;a href=&quot;http://mstechpages.com&quot;&gt;http://mstechpages.com&lt;/a&gt; for what amounts to all this information in &lt;a href=&quot;http://www.mstechpages.com/2011/09/17/set-custom-resolution-in-virtualbox-for-windows-8/&quot; target=&quot;_blank&quot;&gt;this article&lt;/a&gt;&lt;img style=&quot;border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none&quot; class=&quot;wlEmoticon wlEmoticon-smile&quot; alt=&quot;Smile&quot; src=&quot;http://lh6.ggpht.com/-cIxBsq3Q6l8/T1yn5tzrFYI/AAAAAAAAGYI/N0YvMPBSZxw/wlEmoticon-smile%25255B2%25255D.png?imgmax=800&quot;&gt;&lt;/p&gt; &lt;p&gt;T&lt;/p&gt;  </description><link>http://codemares.blogspot.com/2012/03/quick-tip-virtualbox-win-8-custom.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-z5d9ApsvCfM/T1yn4CDi6tI/AAAAAAAAGX0/L82BTCYyDvM/s72-c/image_thumb%25255B5%25255D.png?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-1476181053553585430</guid><pubDate>Sun, 04 Mar 2012 13:30:00 +0000</pubDate><atom:updated>2012-03-04T08:30:57.385-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">JsTrace</category><category domain="http://www.blogger.com/atom/ns#">MVC</category><category domain="http://www.blogger.com/atom/ns#">NuGet</category><title>Released: JsTrace.MVC</title><description>I just released the &lt;a href=&quot;http://jstrace.codeplex.com/&quot; rel=&quot;contributor-to&quot; target=&quot;_blank&quot;&gt;JsTrace&lt;/a&gt; add-on JsTrace.MVC as a &lt;a href=&quot;http://nuget.org/&quot;&gt;NuGet&lt;/a&gt; package.&lt;br /&gt;
&lt;br /&gt;
What is it?&amp;nbsp; It&#39;s a way to automatically proxy JsTrace messages from client-side JavaScript to your MVC application.&lt;br /&gt;
&lt;br /&gt;
Basically, when you add this package, you get the following Area added to your ASP.NET MVC project:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://lh6.ggpht.com/-rgujJ5YAoG8/T1Nsyg6Y9iI/AAAAAAAAGWs/4VA6afBsjvo/s1600-h/Capture%25255B3%25255D.png&quot;&gt;&lt;img alt=&quot;Capture&quot; border=&quot;0&quot; height=&quot;484&quot; src=&quot;http://lh5.ggpht.com/-BzR_YsZDLdM/T1NszTooPEI/AAAAAAAAGW0/fG-8wSi_zqQ/Capture_thumb%25255B1%25255D.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;Capture&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
The JsTraceController has a single &quot;Index&quot; method that receives a JsTraceMessage object.&amp;nbsp; All that contains is the module, level and message sent from the JavaScript side.&lt;br /&gt;
Given the following javascript:&lt;br /&gt;
&lt;pre class=&quot;brush:javascript&quot;&gt;var tracer = new Trace(&#39;TestModule&#39;);
tracer.error(&#39;testing: error message&#39;);&lt;/pre&gt;
The default implementation just outputs to the console using Debug.WriteLine:&lt;br /&gt;
&lt;pre&gt;   JsTrace &amp;gt;&amp;gt; [error] Module &#39;TestModule&#39; : testing: error message&lt;/pre&gt;
All you need to do is use the included HtmlHelper extension method like this, depending on your syntax:&lt;br /&gt;
&lt;pre class=&quot;brush:csharp&quot;&gt;&amp;lt;%: Html.RenderJsTraceProxy() %&amp;gt;&lt;/pre&gt;
or &lt;br /&gt;
&lt;pre class=&quot;brush:csharp&quot;&gt;@Html.RenderJsTraceProxy()&lt;/pre&gt;
&lt;br /&gt;
By default, the rendered script will proxy only messages that pass the “switch test”. If you pass “true” in the RenderJsTraceProxy(), it will send all of them, which might be a bit crazy in production.&lt;br /&gt;
&lt;br /&gt;
The script uses the jQuery $.ajax() method to post a JSON object to the server asynchronously -- ignoring success or error as well.&lt;br /&gt;
&lt;br /&gt;
I may have a follow up version that has more options for the Proxy, like being able to pass a predicate-style (returns boolean) method to determine whether or not to send the message to the server.&amp;nbsp; This way you could customize the logic yourself.&lt;br /&gt;
&lt;br /&gt;
Check it out, and let me know what you think!&lt;br /&gt;
&lt;br /&gt;
T</description><link>http://codemares.blogspot.com/2012/03/released-jstracemvc.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/-BzR_YsZDLdM/T1NszTooPEI/AAAAAAAAGW0/fG-8wSi_zqQ/s72-c/Capture_thumb%25255B1%25255D.png?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-7064794128510278016</guid><pubDate>Mon, 27 Feb 2012 13:17:00 +0000</pubDate><atom:updated>2012-02-27T08:17:08.078-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">debugging</category><category domain="http://www.blogger.com/atom/ns#">instrumentation</category><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">JsTrace</category><category domain="http://www.blogger.com/atom/ns#">NuGet</category><title>JsTrace 1.1.1 released</title><description>&lt;p&gt;So, I released a new version of the &lt;a href=&quot;http://jstrace.codeplex.com/&quot; rel=&quot;contributor-to&quot; target=&quot;_blank&quot;&gt;JsTrace&lt;/a&gt; project.&lt;/p&gt; &lt;p&gt;This version basically includes rewriting things to be a little more &quot;proper&quot; in the JavaScript side of things.&amp;nbsp; &lt;/p&gt; &lt;ol&gt; &lt;li&gt;I removed things like the &quot;with&quot; keyword (reimplemented just using basic closure technique)&lt;/li&gt; &lt;li&gt;Turned on/Fixed a lot of JSHint restrictions (though I still don&#39;t dig the &quot;use one var statement&quot; thing, so I don&#39;t follow that – it&#39;s totally unnecessary in my opinion).&lt;/li&gt; &lt;li&gt;Updated the Intellisense comments so that we have as much info in client code as possible&lt;/li&gt; &lt;li&gt;Updated source code to have a test project and the &lt;a href=&quot;http://nuget.org&quot;&gt;NuGet&lt;/a&gt; package generation in it.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;So, if you&#39;re using the NuGet package, you&#39;ll just get the update automatically, otherwise, go snag it on Codeplex: &lt;a href=&quot;http://jstrace.codeplex.com&quot;&gt;http://jstrace.codeplex.com&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Happy Debugging!&lt;/p&gt; &lt;p&gt;Tom&lt;/p&gt;  </description><link>http://codemares.blogspot.com/2012/02/jstrace-111-released.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-8763995566839938834</guid><pubDate>Sat, 18 Feb 2012 17:12:00 +0000</pubDate><atom:updated>2012-02-18T12:12:12.891-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">debugging</category><category domain="http://www.blogger.com/atom/ns#">instrumentation</category><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">JsTrace</category><category domain="http://www.blogger.com/atom/ns#">NuGet</category><title>Released: JsTrace - My JavaScript Diagnostics Module (NuGet Package too!)</title><description>I&#39;ve been planning on this for a while, but, after my &lt;a href=&quot;http://codemares.blogspot.com/2011/09/much-to-my-chagrin-i-have-been-doing.html&quot; target=&quot;_blank&quot;&gt;original post&lt;/a&gt; post about &lt;a href=&quot;http://jstrace.codeplex.com/&quot; rel=&quot;contributor-to&quot; target=&quot;_blank&quot;&gt;JsTrace&lt;/a&gt;, I wanted to make it easier for people to get to and use.&lt;br /&gt;
&lt;br /&gt;
So, first of all, &lt;a href=&quot;http://jstrace.codeplex.com/&quot; target=&quot;_blank&quot;&gt;I added JsTrace to CodePlex&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Then, I wrote &lt;a href=&quot;http://jstrace.codeplex.com/documentation&quot; target=&quot;_blank&quot;&gt;some pretty decent documentation&lt;/a&gt; for it.&lt;br /&gt;
&lt;br /&gt;
Finally, I published it as a &lt;a href=&quot;http://nuget.org/packages/JsTrace&quot; target=&quot;_blank&quot; title=&quot;JsTrace on NuGet&quot;&gt;NuGet Package&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Use it at will and spread the word!</description><link>http://codemares.blogspot.com/2012/02/released-jstrace-my-javascript.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-8683001830250367094</guid><pubDate>Thu, 09 Feb 2012 02:37:00 +0000</pubDate><atom:updated>2012-02-18T09:18:37.205-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Extension</category><category domain="http://www.blogger.com/atom/ns#">TFS</category><category domain="http://www.blogger.com/atom/ns#">Visual Studio</category><title>Just Published: TFS Solution Info - Visual Studio Extension</title><description>&lt;h3&gt;

The Problem&lt;/h3&gt;
I deal with Team Foundation Server (TFS) a lot day to day, so I occasionally find myself wondering which Branch and/or Workspace I happen to have open on my project at any given time.&amp;nbsp; For some people, this is not a problem, since they work on one particular branch, do their work and then check in.&amp;nbsp; For me, though, it’s different.&lt;br /&gt;
I do parallel development on my project.&amp;nbsp; Sometimes I’m working on a great new feature for 2.0 while switching over to a HotFix branch to do a quick patch for the 1.5 version that’s in Production.&lt;br /&gt;
I also use a separate workspace in TFS to Merge and deploy code.&amp;nbsp; Throw in the “Experimental” Workspace I use to play around in various versions of the code, and you can see why I frequently get lost.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;

The Solution &lt;/h3&gt;
(no pun intended! -- OK, I confess: It was &lt;strong&gt;totally&lt;/strong&gt; intended!)&lt;br /&gt;
Banking on the theory that I’m not alone in this – and, based on my coworker feedback, I’m not – I decided to publish the Visual Studio plugin I created.&lt;br /&gt;
For lack of a better name, I called it “TFS Solution Info”&lt;br /&gt;
Here’s what it looks like&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://lh3.ggpht.com/-eDAOOdaHFbI/TzMxYD37eKI/AAAAAAAAGSE/QQshwj6GqrU/s1600-h/ScreenShot%25255B34%25255D.png&quot;&gt;&lt;img alt=&quot;ScreenShot&quot; border=&quot;0&quot; height=&quot;113&quot; src=&quot;http://lh5.ggpht.com/-qiyZHCT_IhE/TzMxYlAvgvI/AAAAAAAAGSM/dkNbNC09ooc/ScreenShot_thumb%25255B32%25255D.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;ScreenShot&quot; width=&quot;323&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
It’s pretty simple.&amp;nbsp; Using the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb166441(v=vs.100).aspx&quot; target=&quot;_blank&quot;&gt;Visual Studio SDK&lt;/a&gt;, I connected up to Solution events and TFS-related information to display information about the currently loaded Solution.&lt;br /&gt;
&lt;br /&gt;
I can’t believe how useful this has been for me.&amp;nbsp; I hope it’s useful for you too!&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://visualstudiogallery.msdn.microsoft.com/384a4952-6b6f-4391-bc59-1b2bd38e1baf&quot; target=&quot;_blank&quot;&gt;Get TFS Solution Info from the Visual Studio Gallery!&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Or, you can just search for “TFS Solution Info” in the Visual Studio Extension Manager.&amp;nbsp; The code will be posted up on &lt;a href=&quot;http://www.blogger.com/www.codeplex.com&quot; target=&quot;_blank&quot;&gt;Codeplex&lt;/a&gt; very soon.&lt;br /&gt;
&lt;br /&gt;
Let me know what you would like to see this do.&lt;br /&gt;
&lt;br /&gt;
[Update: just updated the formatting]</description><link>http://codemares.blogspot.com/2012/02/just-published-tfs-solution-info-visual.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/-qiyZHCT_IhE/TzMxYlAvgvI/AAAAAAAAGSM/dkNbNC09ooc/s72-c/ScreenShot_thumb%25255B32%25255D.png?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-2673434359264297670</guid><pubDate>Fri, 03 Feb 2012 16:34:00 +0000</pubDate><atom:updated>2012-02-03T11:34:04.501-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">IoC</category><category domain="http://www.blogger.com/atom/ns#">tips</category><title>Pro Tip: Code Analysis, IoC and Excessive Class Coupling</title><description>This is a quick tip:&lt;br /&gt;
&lt;br /&gt;
If you’re using Visual Studio&#39;s &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/3z0aeatx.aspx&quot; target=&quot;_blank&quot;&gt;Code Analysis&lt;/a&gt; to make your code better (and who isn’t?), you’ll obviously have a bit of a problem with any IoC bootstrapping because you’re most likely wiring up a LOT of interfaces and classes together in your bootstrapping logic.&lt;br /&gt;
&lt;br /&gt;
This will result in the CA1506 &quot;Avoid Excessive Class Coupling&quot; warning&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.diagnostics.codeanalysis.suppressmessageattribute.aspx&quot; target=&quot;_blank&quot;&gt;SuppressMessage&lt;/a&gt; to the rescue!&lt;br /&gt;
&lt;br /&gt;
Just decorate your IoC bootstrapper class or method with this:&lt;br /&gt;
&lt;pre class=&quot;brush:csharp&quot;&gt;[SuppressMessage(&quot;Microsoft.Maintainability&quot;,
   &quot;CA1506:AvoidExcessiveClassCoupling&quot;)]
public static class IoC
...
&lt;/pre&gt;
Problem Solved!</description><link>http://codemares.blogspot.com/2012/02/pro-tip-code-analysis-ioc-and-excessive.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-2406017997273008794</guid><pubDate>Sun, 29 Jan 2012 19:26:00 +0000</pubDate><atom:updated>2012-03-18T07:12:47.451-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">debugging</category><category domain="http://www.blogger.com/atom/ns#">instrumentation</category><title>Debug.Assert() – So, what about Release Mode?</title><description>Sometimes, as a developer, you create some little nifty tool to make life easier and you forget that other people may not have come up with that idea/solution and are still struggling with a problem you solved ages ago.&amp;nbsp; &lt;br /&gt;
I was having a Skype conversation with Pete Brown and he said “Why don&#39;t you blog this stuff, or set up a GitHub project or something with these things?”.&amp;nbsp; I told him, “well, actually, I just started blogging!”&amp;nbsp;&amp;nbsp; &lt;br /&gt;
That conversation gave me a figurative kick in the tuchus, so I decided to share a small nugget.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;








Defensive Development&lt;/h3&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
If you know me you know that I am a big fan of code &lt;a href=&quot;http://codemares.blogspot.com/search/label/instrumentation&quot; target=&quot;_blank&quot;&gt;instrumentation&lt;/a&gt; and “defensive development”. I think it’s the best way to protect yourself.&amp;nbsp; To me, developing defensively means that you are doing the following in your code:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Checking all your assumptions&lt;/li&gt;
&lt;li&gt;Checking all your parameters for null or incorrect values&lt;/li&gt;
&lt;li&gt;Verifying things like &lt;a href=&quot;http://en.wikipedia.org/wiki/Loop_invariant&quot; target=&quot;_blank&quot;&gt;loop invariants&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Precondition&quot; target=&quot;_blank&quot;&gt;preconditions&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Postcondition&quot; target=&quot;_blank&quot;&gt;postconditions&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Code_contract&quot;&gt;http://en.wikipedia.org/wiki/Code_contract&lt;/a&gt;, etc&lt;/li&gt;
&lt;/ul&gt;
Generally, you’re trying to “bullet-proof” your code.&lt;br /&gt;
Given that I think like this, I tend to use debug assertions a lot.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
&lt;h3&gt;


Debug.Assert&lt;/h3&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
If you’re not familiar with &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.diagnostics.debug.assert.aspx&quot; target=&quot;_blank&quot;&gt;Debug.Assert&lt;/a&gt;, it basically takes a boolean condition representing an “assertion” or assumption you are making at that point in your code.&amp;nbsp; It also takes an optional message that will be displayed on a modal dialog if the assertion fails.&amp;nbsp; The “Debug” part tells you that it will only run in Debug mode.&amp;nbsp; Essentially, internally, the implementation is wrapped in &quot;#if DEBUG” conditional compilation.&lt;br /&gt;
So, &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.diagnostics.debug.assert.aspx&quot; target=&quot;_blank&quot;&gt;Debug.Assert&lt;/a&gt; is&amp;nbsp; useful, but, what about Release mode? &lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;


What about Release Mode?&lt;/h3&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Well, in the realm of good, solid development, where you test &lt;em&gt;everything&lt;/em&gt; thoroughly and have a long, drawn-out testing period before you deploy, Debug.Assert does the job well while not slowing down the executing code in deployment.&lt;br /&gt;
I think this is Utopian in this day and age.&lt;br /&gt;
For the large majority of developers, extreme performance is not a problem.&amp;nbsp; A few exceptions would be developers who work on:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;BIG games (not words with friends, more like Call Of Duty)&lt;/li&gt;
&lt;li&gt;Operating Systems&lt;/li&gt;
&lt;li&gt;Low-level Device Drivers &lt;/li&gt;
&lt;/ol&gt;
I’m sure there are a few more, but most of us work on Business Applications.&amp;nbsp; These applications don’t usually have extreme performance needs where a few extra “if” statements will be a problem.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;


Release.Assert?&lt;/h3&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Well, Debug.Assert pops up a dialog in the middle of a debugging session.&amp;nbsp; This is obviously not practical in Release Mode, since the user is most likely not a developer and is most likely not running the app inside Visual Studio. &lt;br /&gt;
Of course, you wouldn’t run Debug code in Production either… Right? RIGHT?&lt;br /&gt;
So, our only option is Exceptions.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;


My Solution&lt;/h3&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Well, since I don’t want to lose the nice Debug.Assert functionality of stopping my execution as it runs in debug mode, I decided to implement my solution in terms of Debug.Assert.&amp;nbsp; So, we have these requirements:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;continue to utilize Debug.Assert&lt;/li&gt;
&lt;li&gt;In Release Mode, throw an exception instead.&lt;/li&gt;
&lt;li&gt;Allow for custom exception usage (can’t just throw one kind of exception)&lt;/li&gt;
&lt;/ul&gt;
So, we have the following method: &lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:csharp&quot;&gt;[SuppressMessage(&quot;Microsoft.Design&quot;, &quot;CA1004&quot;, Justification = 
  &quot;This method instantiates and throws the exception, it can&#39;t be passed in&quot;)]
[DebuggerStepThrough()]
public static void AssertThrow&amp;lt;TException&amp;gt;(bool condition, 
   string failureMessage) where TException : Exception
{
    Debug.Assert(condition, failureMessage);
    if (condition == false)
    {
        // throw exception here...
    }
}
&lt;/pre&gt;
The [SuppressMessage] is there in case you’re running Code Analysis.  The analysis tools don’t like that the method is using a generic type that’s not part of the rest of the function signature.
&lt;br /&gt;
&lt;br /&gt;
The [DebuggerStepThrough] just makes it so that it steps over this as if it’s one execution statement when debugging.&lt;br /&gt;
&lt;br /&gt;
The Debug.Assert line is rather obvious, so I’ll skip that.&lt;br /&gt;
&lt;br /&gt;
The &quot;where TException : Exception&quot; part forces the type you specify to be a derived class of System.Exception, so it can be thrown.&lt;br /&gt;
The next section is where we throw the exception.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:csharp&quot;&gt;ConstructorInfo ctor = typeof(TException).GetConstructor(
   new Type[] { typeof(string) });
TException ex = (TException)ctor.Invoke(new object[] { failureMessage });
throw ex;
&lt;/pre&gt;
&lt;br /&gt;
I’m using Reflection to get the constructor of the TException object that takes one string. Then, I am invoking that constructor with the failureMessage and throwing the exception.
&lt;br /&gt;
&lt;br /&gt;
So, all you do is call it like this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:csharp&quot;&gt;void Foo(Bar bar)
{
    Diag.AssertThrow&amp;lt;ArgumentNullException&amp;gt;(
        bar != null, &quot;Duh, Foo needs a Bar!&quot;);
        
    // use bar here.
}
&lt;/pre&gt;
&lt;h3&gt;



Teh Codez&lt;/h3&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Here is the complete listing without all the line wraps and with comments.  Once I set up a paid Github account or something like that, I’ll start moving code elsewhere:
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:csharp&quot;&gt;using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;

namespace McKearney.Common.Diagnostics
{
    /// &amp;lt;summary&amp;gt;
    /// Utility class that contains Diagnostic- and Instrumentation-related methods
    /// &amp;lt;/summary&amp;gt;
    public static class Diag
    {
        #region Static Operations

        /// &amp;lt;summary&amp;gt;
        /// Asserts and then throws, making sure that the error gets handled by client code
        /// &amp;lt;/summary&amp;gt;
        /// &amp;lt;typeparam name=&quot;TException&quot;&amp;gt;The type of the exception to throw.&amp;lt;/typeparam&amp;gt;
        /// &amp;lt;param name=&quot;condition&quot;&amp;gt;the asserted condition&amp;lt;/param&amp;gt;
        /// &amp;lt;param name=&quot;failureMessage&quot;&amp;gt;The failure message.&amp;lt;/param&amp;gt;
        [SuppressMessage(&quot;Microsoft.Design&quot;, &quot;CA1004&quot;, Justification = &quot;This method instantiates and throws the exception, it can&#39;t be passed in&quot;)]
        [DebuggerStepThrough()]
        public static void AssertThrow&amp;lt;texception&amp;gt;(bool condition, string failureMessage) where TException : Exception
        {
            Debug.Assert(condition, failureMessage);
            if (condition == false)
            {
                ConstructorInfo ctor = typeof(TException).GetConstructor(new Type[] { typeof(string) });
                TException ex = (TException)ctor.Invoke(new object[] { failureMessage });
                throw ex;
            }
        }
    }
}
&lt;/pre&gt;
&lt;br /&gt;
Leave me a comment, I&#39;m curious what your thoughts are.</description><link>http://codemares.blogspot.com/2012/01/debugassert-so-what-about-release-mode.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-5389128586612275507</guid><pubDate>Sat, 28 Jan 2012 13:30:00 +0000</pubDate><atom:updated>2012-01-28T08:30:41.747-05:00</atom:updated><title>My project featured as a Microsoft Case Study</title><description> &lt;p&gt;It’s kind of neat seeing your own project &lt;a href=&quot;http://www.microsoft.com/casestudies/Windows-Azure/Applied-Information-Sciences/Major-Jewelry-Manufacturer-Anticipates-300-Percent-Annual-ROI-with-Cloud-Based-Solution/4000011645&quot; target=&quot;_blank&quot;&gt;featured as a Microsoft Case Study&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Of course, now I want to update it with more information, since a lot has happened since we gave them all that information.&amp;nbsp; The project has actually had a direct effect on the company’s quarterly profits and is now going to be rolled out internationally (in phases).&amp;nbsp; &lt;/p&gt; &lt;p&gt;Anyway, wanted to pause to toot my own horn for a sec.&amp;nbsp; Toot! Toot! &lt;img style=&quot;border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none&quot; class=&quot;wlEmoticon wlEmoticon-winkingsmile&quot; alt=&quot;Winking smile&quot; src=&quot;http://lh4.ggpht.com/-CMGSfxn3Z4k/TyP4gZ9T7LI/AAAAAAAAGP4/KAgIi17-IyU/wlEmoticon-winkingsmile%25255B2%25255D.png?imgmax=800&quot;&gt;&lt;/p&gt;  </description><link>http://codemares.blogspot.com/2012/01/my-project-featured-as-microsoft-case.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/-CMGSfxn3Z4k/TyP4gZ9T7LI/AAAAAAAAGP4/KAgIi17-IyU/s72-c/wlEmoticon-winkingsmile%25255B2%25255D.png?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-123757808627822524</guid><pubDate>Sat, 28 Jan 2012 13:14:00 +0000</pubDate><atom:updated>2012-01-29T13:25:37.941-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Microsoft</category><category domain="http://www.blogger.com/atom/ns#">passwords</category><category domain="http://www.blogger.com/atom/ns#">rants</category><title>Live.com password idiocy</title><description>&lt;h3&gt;
Back Story&lt;/h3&gt;
I use &lt;a href=&quot;http://keepass.info/&quot; target=&quot;_blank&quot;&gt;Keepass&lt;/a&gt; to maintain all my passwords. Then, I have this password database stored in a USB key I carry with me.&amp;nbsp; I only have to remember &lt;strong&gt;one&lt;/strong&gt; highly-entropic password (doesn’t mean it’s hard to remember, it just has to be hard to guess). So, I try to make my other passwords as complicated as possible.&lt;br /&gt;
&lt;h3&gt;
Changing My Password on Live.com&lt;/h3&gt;
Anyway, I went to change my password on live,com like I prefer to do on a semi-regular basis.&amp;nbsp; I got to their page and entered a new password.&amp;nbsp; I tried one that was 256 characters long, but I noticed that, with no warning at all, it truncated my password at 16 characters. &lt;br /&gt;
So, they have a minimum of 6 characters (which is on the page) and an apparent maximum of 16 characters.&amp;nbsp; So, I changed the options to generate a 16-character password with all sorts of variability in the characters used and I try again: (This time it was: “{j/ýQîÔ·z4Ú«&amp;lt;[“)&lt;br /&gt;
Now, I get this lovely message:&lt;br /&gt;
&lt;a href=&quot;http://lh5.ggpht.com/-US_OKFxyPrM/TyP0vPftefI/AAAAAAAAGPo/UggVlDEQaj8/s1600-h/LivePwdIdiocy%25255B7%25255D.png&quot;&gt;&lt;img alt=&quot;LivePwdIdiocy&quot; border=&quot;0&quot; height=&quot;455&quot; src=&quot;http://lh4.ggpht.com/-hsf5qObh2cE/TyP0v_zRjhI/AAAAAAAAGPw/PgHlz2bql2k/LivePwdIdiocy_thumb%25255B5%25255D.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;LivePwdIdiocy&quot; width=&quot;644&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h3&gt;
What’s Missing?&lt;/h3&gt;
Apparently, the powers that be at Microsoft (Live.com) aren’t going to bother telling me what characters are and are not allowed!&amp;nbsp; So, what?&amp;nbsp; I just sit here and guess for hours?&lt;br /&gt;
I was reminded of &lt;a href=&quot;http://xkcd.com/936/&quot; target=&quot;_blank&quot;&gt;this great xkcd comic&lt;/a&gt;. This is not security!&amp;nbsp; It’s obscurity.&amp;nbsp; Making a person choose a password within 6-16 characters with a fixed subset of characters allowed just trims down the dataset that a computer needs to search while trying to crack the password. At the same time, requiring special characters (but not &lt;em&gt;that&lt;/em&gt; special!) to be there in order to make it strong just makes it harder for humans to guess with the wonderful side effect of also making them nearly impossible to remember!&lt;br /&gt;
Well, I’m going to go keep trying passwords over and over again until I find one it will allow…ugh</description><link>http://codemares.blogspot.com/2012/01/livecom-password-idiocy.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/-hsf5qObh2cE/TyP0v_zRjhI/AAAAAAAAGPw/PgHlz2bql2k/s72-c/LivePwdIdiocy_thumb%25255B5%25255D.png?imgmax=800" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-3001030943096288134</guid><pubDate>Thu, 26 Jan 2012 16:49:00 +0000</pubDate><atom:updated>2012-01-26T11:49:06.238-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">Cache</category><category domain="http://www.blogger.com/atom/ns#">IE</category><category domain="http://www.blogger.com/atom/ns#">OutputCache</category><title>ASP.NET MVC OutputCache override</title><description>&lt;br /&gt;
&lt;h3&gt;



IE Strikes Again!&lt;/h3&gt;
Because of my recent discovery of the &lt;a href=&quot;http://dougwilsonsa.wordpress.com/2011/04/29/disabling-ie9-ajax-response-caching-asp-net-mvc-3-jquery/&quot; target=&quot;_blank&quot;&gt;IE9 “feature” that makes it cache unlike every other browser&lt;/a&gt;, I had to come up with a small change to our caching scheme on my project. To be fair, the IE9 team is actually well within RFC definitions of how to handle “cache-control: private”, so I shouldn’t complain too much about it. Though, why is it always IE that causes me to do extra coding?&lt;br /&gt;
&lt;br /&gt;
Anyway, my solution was to add a “Default” &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.web.mvc.outputcacheattribute.aspx&quot; target=&quot;_blank&quot;&gt;OutputCache&lt;/a&gt; setting for all my MVC Controllers and then, to override these options on individual Controller Actions when needed.&amp;nbsp; The problem is: I can’t find any information on whether or not an &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.web.mvc.outputcacheattribute.aspx&quot; target=&quot;_blank&quot;&gt;OutputCache&lt;/a&gt; directive on an Action will override one on the Controller. &lt;br /&gt;
&lt;br /&gt;
So, I wrote a quick test app to test it out.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;



The Code&lt;/h3&gt;
&lt;pre class=&quot;brush:csharp&quot;&gt;    // default everything to a tiny cache time
    [OutputCache(CacheProfile=&quot;ShortCache&quot;)]
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = &quot;Welcome to ASP.NET MVC!&quot;;
            return View();
        }

        // change to a longer cache time
        [OutputCache(CacheProfile = &quot;LongCache&quot;)]
        public ActionResult About()
        {
            return View();
        }
    }&lt;/pre&gt;
&lt;br /&gt;
&lt;h3&gt;



Web.config mods&lt;/h3&gt;
&lt;pre class=&quot;brush:xml&quot;&gt;  
&amp;lt;system.web&amp;gt;
      &amp;lt;caching&amp;gt;
        &amp;lt;outputcachesettings&amp;gt;
          &amp;lt;outputcacheprofiles&amp;gt;
            &amp;lt;add duration=&quot;1&quot; name=&quot;ShortCache&quot; varybyparam=&quot;*&quot;&amp;gt;
            &amp;lt;add duration=&quot;60&quot; name=&quot;LongCache&quot; varybyparam=&quot;*&quot;&amp;gt;
          &amp;lt;/add&amp;gt;&amp;lt;/add&amp;gt;&amp;lt;/outputcacheprofiles&amp;gt;
        &amp;lt;/outputcachesettings&amp;gt;
      &amp;lt;/caching&amp;gt;
  &amp;lt;/system.web&amp;gt;
&lt;/pre&gt;
&lt;h3&gt;

Results&lt;/h3&gt;
Well, What do you know!?  It worked!  Hopefully someone else stumbles across this and saves themselves some time.</description><link>http://codemares.blogspot.com/2012/01/aspnet-mvc-outputcache-override.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-8883103453165874389</guid><pubDate>Mon, 16 Jan 2012 15:11:00 +0000</pubDate><atom:updated>2012-01-16T10:11:30.047-05:00</atom:updated><title>Silverlight 5 Toolkit, 3D and crappy installers..</title><description>&lt;p&gt;&amp;nbsp;&amp;nbsp; I&#39;m in the rather &lt;strike&gt;grueling&lt;/strike&gt; awesome process of tech reviewing my friend &lt;a href=&quot;http://10rem.net/&quot;&gt;Pete Brown&lt;/a&gt;&#39;s new book, &lt;a href=&quot;http://www.manning.com/pbrown2/&quot;&gt;Silverlight 5 In Action&lt;/a&gt;.&amp;nbsp; As a part of that, I had to get setup with the &lt;a title=&quot;Silverlight 5 Toolkit&quot; href=&quot;http://silverlight.codeplex.com&quot; target=&quot;_blank&quot;&gt;Silverlight 5 Toolkit&lt;/a&gt; in order to get the new 3D templates.&amp;nbsp; &lt;/p&gt; &lt;p&gt;&amp;nbsp;&amp;nbsp; Frankly, I&#39;m rather excited at the prospect of playing around with 3D stuff in Silverlight.&amp;nbsp; We&#39;ve come a very long way since the days of just displaying simple things like a clock in a browser plugin. &lt;p&gt;&amp;nbsp;&amp;nbsp; So, I install the toolkit and start up Visual Studio 2010 and choose a Silverlight 3D Application &lt;p&gt;&lt;a href=&quot;http://lh5.ggpht.com/-1zUIxvx92Mw/TxQ-D7lJBTI/AAAAAAAAGKg/XhHI3u9Xeks/s1600-h/image%25255B8%25255D.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;http://lh5.ggpht.com/-1D8Q7sI98Gs/TxQ-EdOniFI/AAAAAAAAGKo/gEDoWJNtJVs/image_thumb%25255B6%25255D.png?imgmax=800&quot; width=&quot;466&quot; height=&quot;46&quot;&gt;&lt;/a&gt; &lt;p&gt;I called my project “Silverlight3dExample”.&amp;nbsp; Now, Visual Studio fires up the hamsters in their wheels and all the other rube goldberg-esque machinations inside and comes up with this lovely tandem of errors:&lt;/p&gt; &lt;p align=&quot;center&quot;&gt;&lt;a href=&quot;http://lh4.ggpht.com/-e6x5mZyLt-I/TxQ-E06cm0I/AAAAAAAAGKw/BFow8oLjMmA/s1600-h/clip_image002%25255B6%25255D.jpg&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;clip_image002&quot; border=&quot;0&quot; alt=&quot;clip_image002&quot; src=&quot;http://lh6.ggpht.com/-Y5wTq7T8DuY/TxQ-FenwgrI/AAAAAAAAGK4/9HtOR2pc_hE/clip_image002_thumb%25255B3%25255D.jpg?imgmax=800&quot; width=&quot;244&quot; height=&quot;93&quot;&gt;&lt;/a&gt;&lt;/p&gt; &lt;p align=&quot;center&quot;&gt;&lt;a href=&quot;http://lh4.ggpht.com/-B-vgl7GFt5s/TxQ-FiD9v-I/AAAAAAAAGLA/MSBhEQkfgT0/s1600-h/clip_image002%25255B7%25255D%25255B2%25255D.jpg&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;clip_image002[7]&quot; border=&quot;0&quot; alt=&quot;clip_image002[7]&quot; src=&quot;http://lh3.ggpht.com/-BGS_ULfoc-A/TxQ-GCs6FKI/AAAAAAAAGLI/_VofavkAkoQ/clip_image002%25255B7%25255D_thumb.jpg?imgmax=800&quot; width=&quot;244&quot; height=&quot;93&quot;&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;So, after a bit of googling, I realized, much to my chagrin, that I neglected a rather important notice on the screen of the Toolkit:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;Note: &lt;b&gt;You must install XNA Studio in order to use the new Silverlight 3D templates.&lt;/b&gt;Otherwise the new templates will not show up.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Oh.. uhh.. oops.&amp;nbsp; Seems kind of odd that such a big missing prerequisite isn’t also detected by the installer, but, whatever…&lt;/p&gt; &lt;p&gt;So, I download XNA studio and install that… more whirring, banging from my machine ensues.&amp;nbsp; Then, just in case things won’t recover gently, I decide to create the solution from scratch again.&amp;nbsp; After all, I hadn’t done anything yet.&lt;/p&gt; &lt;p&gt;Woohoo! all 4 projects successfully created!&lt;/p&gt; &lt;p align=&quot;center&quot;&gt;&lt;a href=&quot;http://lh4.ggpht.com/-xGoljP-4Zso/TxQ-GqepJ6I/AAAAAAAAGLQ/UZnKeVt16Zo/s1600-h/image%25255B11%25255D.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;http://lh6.ggpht.com/-9XpRSyo_e_c/TxQ-IT-wnWI/AAAAAAAAGLY/a1dlFCnhpoQ/image_thumb%25255B7%25255D.png?imgmax=800&quot; width=&quot;244&quot; height=&quot;117&quot;&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Sweetness, right!?&amp;nbsp; So, I hit Ctrl-Shift-B (build command for you mouse-using pansies out there) and voila, everything builds!&amp;nbsp; Just kidding!&amp;nbsp; Now, I get this obvious and very helpful error:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;Compile error -2147024770 &lt;p&gt;(0, 0): error : Unknown compile error (check flags against DX version) D:\Dev\Book…Silverlight3dExample\Silverlight3dApp\CustomEffect.slfx &lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Umm.. OK.. Googling… googling… uh… yeah… Apparently, there’s another prerequisite missing that the installer &lt;strong&gt;also&lt;/strong&gt; doesn’t check for: DirectX 9.&amp;nbsp; So, I download that and install (cringing at every single “installing XX update from 2006” message – how can that really not break my machine?). &lt;p&gt;Finally, it actually builds!&amp;nbsp; No thanks to the Silverlight Toolkit guys (well, &lt;em&gt;some&lt;/em&gt; thanks, since they wrote it in the first place!), I can now continue to review this chapter of what really is a &lt;a title=&quot;Silverlight 5 In Action&quot; href=&quot;http://www.manning.com/pbrown2/&quot; target=&quot;_blank&quot;&gt;pretty killer book&lt;/a&gt;, you should buy it. Now.&lt;/p&gt;  </description><link>http://codemares.blogspot.com/2012/01/silverlight-5-toolkit-3d-and-crappy.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/-1D8Q7sI98Gs/TxQ-EdOniFI/AAAAAAAAGKo/gEDoWJNtJVs/s72-c/image_thumb%25255B6%25255D.png?imgmax=800" height="72" width="72"/><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-2155403873651769142</guid><pubDate>Tue, 10 Jan 2012 21:01:00 +0000</pubDate><atom:updated>2012-01-10T16:01:28.173-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">touch</category><category domain="http://www.blogger.com/atom/ns#">weinre</category><title>Yes, I&#39;m 12...</title><description>So, I moused over my explorer windows on my taskbar and this popped up:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSh2jRz2VMMynkwhDw5E7dlLHwjO6QWP02R1qwZ1qO4x1IThHldIIwP5dls7e4utEUFrtboeJoooXHCQPufuQplIwcKoQdfyAVTe9WWfSqAnyiMoeklBG4MqPlvVhtl69kw4WBS5s-80vf/s1600/Touch.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;192&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSh2jRz2VMMynkwhDw5E7dlLHwjO6QWP02R1qwZ1qO4x1IThHldIIwP5dls7e4utEUFrtboeJoooXHCQPufuQplIwcKoQdfyAVTe9WWfSqAnyiMoeklBG4MqPlvVhtl69kw4WBS5s-80vf/s640/Touch.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Yep.. giggled like a 12 year old and told my friends about it :)&lt;br /&gt;
&lt;br /&gt;</description><link>http://codemares.blogspot.com/2012/01/yes-im-12.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSh2jRz2VMMynkwhDw5E7dlLHwjO6QWP02R1qwZ1qO4x1IThHldIIwP5dls7e4utEUFrtboeJoooXHCQPufuQplIwcKoQdfyAVTe9WWfSqAnyiMoeklBG4MqPlvVhtl69kw4WBS5s-80vf/s72-c/Touch.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-3771548809501444656</guid><pubDate>Thu, 22 Dec 2011 11:39:00 +0000</pubDate><atom:updated>2011-12-22T06:39:39.855-05:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">globalization</category><category domain="http://www.blogger.com/atom/ns#">Javascript</category><title>JavaScript Globalization</title><description>&lt;br /&gt;
I am leading a project that is now going to go from running in the US to running across the world over the next 6+ months.&lt;br /&gt;
&lt;br /&gt;
It currently uses a lot of different tech: &lt;a href=&quot;http://www.asp.net/mvc&quot; target=&quot;_blank&quot;&gt;ASP.NET MVC3&lt;/a&gt;, HTML5, &lt;a href=&quot;http://jquery.com/&quot; target=&quot;_blank&quot;&gt;jQuery&lt;/a&gt;, &lt;a href=&quot;http://jqueryui.com/&quot; target=&quot;_blank&quot;&gt;jQuery UI&lt;/a&gt;, &lt;a href=&quot;http://knockoutjs.com/&quot; target=&quot;_blank&quot;&gt;KnockoutJs &lt;/a&gt;(w/Mapping), &lt;a href=&quot;http://api.jquery.com/category/plugins/templates/&quot; target=&quot;_blank&quot;&gt;jQuery Templates&lt;/a&gt;, &lt;a href=&quot;http://datatables.net/&quot; target=&quot;_blank&quot;&gt;jQuery DataTables&lt;/a&gt;, EF4 and a host of other home-grown and one-off type technologies.&lt;br /&gt;
&lt;br /&gt;
So, I started browsing the usual suspects, especially a previously bookmarked &lt;a href=&quot;http://www.hanselman.com/blog/GlobalizationInternationalizationAndLocalizationInASPNETMVC3JavaScriptAndJQueryPart1.aspx&quot; target=&quot;_blank&quot;&gt;Scott Hanselman blog post&lt;/a&gt;&amp;nbsp;(suspiciously a 7-month-old &quot;part 1&quot; with no &quot;part 2&quot; yet *holds breath*).&lt;br /&gt;
&lt;br /&gt;
Well, the most confusing part I have run across so far is how to handle JavaScript and jQuery globalization. &amp;nbsp;There was &lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2010/06/10/jquery-globalization-plugin-from-microsoft.aspx&quot; target=&quot;_blank&quot;&gt;one project by Microsoft&lt;/a&gt; that was donated/accepted/rejected by the jQuery folks (sounds familiar... jQuery Templates had the same problem) which, apparently went through a few renamings (&lt;a href=&quot;https://github.com/nje/jquery-glob&quot; target=&quot;_blank&quot;&gt;one&lt;/a&gt;, &lt;a href=&quot;https://github.com/jquery/jquery-global&quot; target=&quot;_blank&quot;&gt;two&lt;/a&gt;, &lt;a href=&quot;http://damianedwards.wordpress.com/2011/07/08/the-jquery-globalization-plugin-becomes-globalize/&quot; target=&quot;_blank&quot;&gt;three&lt;/a&gt;), the last of which was a renaming to &quot;Globalize&quot;, total api change and removal of any dependency on jQuery (not sure if there was ever one, but didn&#39;t bother to get into it). &lt;br /&gt;
&lt;br /&gt;
Confusingly, this library (not a plugin anymore) is maintained/developed by the jQuery UI team now, even though there&#39;s no dependency.&lt;br /&gt;
&lt;br /&gt;
So, apparently, the supported(?), in-development code is now the &lt;a href=&quot;https://github.com/jquery/globalize&quot; target=&quot;_blank&quot;&gt;&quot;Globalize&quot; library&lt;/a&gt;&amp;nbsp;whose wiki is &lt;a href=&quot;http://wiki.jqueryui.com/w/page/39118647/Globalize&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&amp;nbsp;(on the jQuery UI site, where else? ... O_o)&lt;br /&gt;
&lt;br /&gt;
Hope that helps save someone else some time.</description><link>http://codemares.blogspot.com/2011/12/javascript-globalization.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-5013961147090178455</guid><pubDate>Sat, 19 Nov 2011 17:50:00 +0000</pubDate><atom:updated>2012-03-18T07:13:47.586-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Patterns</category><title>Chain Of Responsibility Implementation</title><description>I was reading my twitter feed and came across a retweet from &lt;a href=&quot;http://blogs.msdn.com/b/gblock/&quot; target=&quot;_blank&quot; title=&quot;Go to Glenn&#39;s blog&quot;&gt;Glenn Block&lt;/a&gt;. The original was from &lt;a href=&quot;http://www.amazedsaint.com/&quot; target=&quot;_blank&quot;&gt;Anoop Madhusudanan&lt;/a&gt; which pointed to his blog post called “&lt;a href=&quot;http://www.amazedsaint.com/2011/11/chain-of-responsibility-design-pattern.html&quot; target=&quot;_blank&quot;&gt;Implementing Chain of Responsibility Design Pattern in C# using Managed Extensibility Framework (MEF)&lt;/a&gt;”.&amp;nbsp; It sounded very interesting, so I dug in.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;[UPDATE:&amp;nbsp;I have since updated this post. &amp;nbsp;Look for the block at the bottom]\&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;h3&gt;




The Problem&lt;/h3&gt;
Anoop’s Chain Of Responsibility example starts with this:&lt;br /&gt;
&lt;pre class=&quot;brush: csharp&quot;&gt;//Request
class LoanRequest  
{  
    public string Customer { get; set; }  
    public decimal Amount { get; set; }  
}  
  
//Abstract Request Handler  
interface IRequestHandler  
{  
    string Name { get; set; }  
    void HandleRequest(LoanRequest req);  
    IRequestHandler Successor { get; set; }  
}  &lt;/pre&gt;
&lt;i&gt;&lt;b&gt;[Insert record-scratch sound here]&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
I couldn’t get past this part without writing this blog post.&lt;br /&gt;
Can you see the problem? … No? Let me give you a hint:&lt;br /&gt;
&lt;pre class=&quot;brush: csharp&quot;&gt;//Abstract Request Handler
interface IRequestHandler  
{      
    string Name { get; set; }      
    void HandleRequest(LoanRequest req);     
 
    ------======&amp;gt;&amp;gt;&amp;gt;  
    ------======&amp;gt;&amp;gt;&amp;gt;  IRequestHandler Successor { get; set; }
    ------======&amp;gt;&amp;gt;&amp;gt;  
}  &lt;/pre&gt;
WAIT!&amp;nbsp; Hold on!&amp;nbsp; Why does the IRequestHandler know about its successor? Why would I, as a consumer of an IRequestHandler want access to its successor? To me, there is no part of IRequestHandler’s responsibility that involves knowing about and/or forwarding on a request to some other instance of itself.&lt;br /&gt;
&lt;h3&gt;




The Solution&lt;/h3&gt;
I prefer more of a MVA/DMV mentality for the IRequestHandler&lt;br /&gt;
(“It’s not MY Job, go somewhere else!”)&lt;br /&gt;
&lt;pre class=&quot;brush: csharp&quot;&gt;// New Request Handler  
interface IRequestHandler 
{ 
    string Name { get; set; } 
    bool HandleRequest(LoanRequest req); 
}&lt;/pre&gt;
In this approach, the HandleRequest method returns a boolean telling whether or not it actually handled the request.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;




And Another Thing&lt;/h3&gt;
One other flaw of Anoop’s approach: if the request makes it all the way through the chain and doesn’t get handled, we have no indication that it was not handled. In the new approach, we get a nice, pleasant boolean value.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;




What Am I Forgetting?&lt;/h3&gt;
Wait, you say? What about the Chain Of Responsibility? I don’t see any Chain and you promised me a Chain!&lt;br /&gt;
&lt;br /&gt;
Oh …. yeah… ok..&lt;br /&gt;
So, now that the interface makes me feel all warm and fuzzy, we need to implement the Chain Of Responsibility pattern. I prefer to implement the Chain Of Responsibility in terms of a variation on the Composite Pattern:&lt;br /&gt;
&lt;pre class=&quot;brush: csharp&quot;&gt;class ChainingRequestHandler : IRequestHandler
{
    private readonly IEnumerable&amp;lt;IRequestHandler&amp;gt; _handlers;
    public ChainingRequestHandler(IEnumerable&amp;lt;IRequestHandler&amp;gt; handlers)
    {
        _handlers = handlers;
    }

    public string Name { get; set; } 

    public bool HandleRequest(LoanRequest req)
    {
        // iterate of the chain
        foreach(IRequestHandler handler in _handlers)
        {
            if (handler.HandleRequest(req) == true)
            {
                // it was handled
                return true;
            }
        }
        // no such luck
        return false;
    }
}&lt;/pre&gt;
&lt;br /&gt;
&lt;h3&gt;




Conclusion&lt;/h3&gt;
By using the a variation on the composite pattern, we allow the client code to use the nice, simple IRequestHandler without any knowledge of the underlying complexity of implementation, or that there’s even a Chain Of Responsibility at all.&lt;br /&gt;
&lt;br /&gt;
I don’t know about you, but that warms the cockles of my development heart.&lt;br /&gt;
Now, doesn’t that feel better?&lt;br /&gt;
Now, I think I should go read the rest of that article!&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;[UPDATE]&lt;/b&gt;&lt;br /&gt;
So, after I blogged about it and &lt;a href=&quot;https://twitter.com/#!/tommckearney/status/137940555014475777&quot; target=&quot;_blank&quot;&gt;whined on Twitter&lt;/a&gt;, I finished the rest of the article, which was a nice application of MEF to the pattern. &amp;nbsp;I also read some other MEF-related posts on Anoop&#39;s blog, which were also informative. I exchanged a few tweets with Anoop as well.&lt;br /&gt;
&lt;br /&gt;
I should point out that Anoop&#39;s implementation is actually &lt;b&gt;exactly&lt;/b&gt;&amp;nbsp;what the Chain Of Responsibility pattern is supposed to be (I&#39;m suspecting the void return value was just a bug/oversight). My &lt;i&gt;actual&lt;/i&gt; problem is with the Chain Of Responsibility pattern itself. &lt;br /&gt;
&lt;br /&gt;
From a business perspective, I understand the idea of knowing the &quot;successor&quot; in the chain. &amp;nbsp;In this instance, of course the Cashier knows who her Manager is at a given time, but:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;What happens when there&#39;s a shift change? &amp;nbsp;&lt;/li&gt;
&lt;li&gt;What happens if there are two Managers in the office? &amp;nbsp;&lt;/li&gt;
&lt;li&gt;What happens if there are &lt;i&gt;zero&lt;/i&gt; Managers in the office?&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
I just feel that the stock pattern limits the implementation too much. I also believe that my approach, while handling the stock Chain Of Responsibility goals well enough also has added benefits.&lt;br /&gt;
&lt;br /&gt;
First, It adds an implementation abstraction from the client code. The user of IRequestHandler does not need to know about Successors or anything else like that. In stead of having client code talk to a class that then talks to the Chain, the Chain can be handed back to the client code in the form of the simple interface.&lt;br /&gt;
&lt;br /&gt;
Secondly, given this new abstraction, it simplifies the interfaces while allowing a greater abstraction for the Chaining. Thus, the developer can implement some sort of Factory/Bootstrapping/IoC &amp;nbsp;implementation for creating the Handler used by the client code. This way, the Chain ordering can be redefined, the Chain can be replaced with a Directed Graph or a Workflow without the client code OR the IRequestHandler-derived classes being any the wiser.&lt;br /&gt;
&lt;br /&gt;
So, my secondary conclusion here is: &amp;nbsp;Anoop didn&#39;t do anything wrong, it&#39;s just that the Chain Of Responsibility pattern should really have 1 extra level of abstraction in it to make it as flexible as possible.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description><link>http://codemares.blogspot.com/2011/11/chain-of-responsibility-implementation.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-2758013307589958174</guid><pubDate>Mon, 07 Nov 2011 19:06:00 +0000</pubDate><atom:updated>2011-11-07T14:25:16.903-05:00</atom:updated><title>Hmm.. which one’s broken, Linq, Debugger, IDE?</title><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;So, I ran into an as of yet unsolved problem today.&amp;nbsp; I don’t know if this is a Linq bug, a debugger bug, or a Visual Studio bug, but, for your viewing pleasure:&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;http://lh3.ggpht.com/-D3VD-nxfjiE/TrgsNx4ThII/AAAAAAAAFTM/R9sT3J7a-5c/s1600-h/image%25255B9%25255D.png&quot;&gt;&lt;img style=&quot;background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;http://lh4.ggpht.com/-tJPmludvYY4/TrgsOQaOQHI/AAAAAAAAFTU/uJ9nM7AXMe8/image_thumb%25255B7%25255D.png?imgmax=800&quot; width=&quot;644&quot; height=&quot;333&quot;&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;If I can figure out what’s going on, I’ll post an update&lt;/p&gt; &lt;p&gt;&lt;strong&gt;EDIT: Figured it out..&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;This is one of the big reasons I don’t like operator overloading… &lt;p&gt;The items inside the FilterList overrode the comparison operators, but did not handle “null” properly… &lt;p&gt;Grrr..&lt;/p&gt;  </description><link>http://codemares.blogspot.com/2011/11/hmm-which-ones-broken-linq-debugger-ide.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/-tJPmludvYY4/TrgsOQaOQHI/AAAAAAAAFTU/uJ9nM7AXMe8/s72-c/image_thumb%25255B7%25255D.png?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-2530311006588223230</guid><pubDate>Thu, 03 Nov 2011 10:49:00 +0000</pubDate><atom:updated>2011-11-03T08:22:52.634-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">CSS</category><category domain="http://www.blogger.com/atom/ns#">HTML</category><title>CSS Transform help</title><description>Just a quick blurb here...&lt;br /&gt;
&lt;br /&gt;
I decided to try to do some fancy CSS stuff for my client website. &amp;nbsp;It involves gradients, transforms and stuff like that. &amp;nbsp;Anybody who&#39;s messed with that stuff knows that it&#39;s a huge pain in the butt to get it working in all the browsers, never mind one! &amp;nbsp;So, here you go:&amp;nbsp;&lt;a href=&quot;http://css3generator.com/&quot; target=&quot;_blank&quot;&gt;http://css3generator.com/&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
You&#39;re welcome :)</description><link>http://codemares.blogspot.com/2011/11/css-transform-help.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-9188438729807389029</guid><pubDate>Wed, 26 Oct 2011 14:20:00 +0000</pubDate><atom:updated>2011-10-26T10:20:21.423-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">AppFabric</category><category domain="http://www.blogger.com/atom/ns#">azure</category><category domain="http://www.blogger.com/atom/ns#">Cache</category><title>Windows Azure AppFabric Cache&amp;#39;s Miniscule Features</title><description>&lt;p&gt;&lt;font size=&quot;2&quot;&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;font size=&quot;2&quot;&gt;Just wanted to warn/inform people who are considering using AppFabric Caching in Azure…&lt;/font&gt; &lt;p&gt;&lt;font size=&quot;2&quot;&gt;Here’s a list of things it &lt;strong&gt;won’t&lt;/strong&gt; do:&lt;/font&gt; &lt;ul&gt; &lt;li&gt;&lt;font size=&quot;2&quot;&gt;Regions&lt;/font&gt;&lt;/li&gt; &lt;li&gt;&lt;font size=&quot;2&quot;&gt;Named Caches&lt;/font&gt;&lt;/li&gt; &lt;li&gt;&lt;font size=&quot;2&quot;&gt;Allow you to get a list of cache keys currently in use&lt;/font&gt;&lt;/li&gt; &lt;li&gt;&lt;font size=&quot;2&quot;&gt;High Availability Mode (redundant copies across machines for durability)&lt;/font&gt;&lt;/li&gt; &lt;li&gt;&lt;font size=&quot;2&quot;&gt;No sliding window expiration&lt;/font&gt;&lt;/li&gt; &lt;li&gt;&lt;font size=&quot;2&quot;&gt;No events for things like eviction, add/remove, etc. &lt;/font&gt;&lt;/li&gt; &lt;ul&gt; &lt;li&gt;&lt;font size=&quot;2&quot;&gt;so you can’t update a local cache with events from the global cache&lt;/font&gt;&lt;/li&gt; &lt;li&gt;&lt;font size=&quot;2&quot;&gt;You don’t get notified if something is removed, so you only know when you get “null” back from a Get()&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt; &lt;li&gt;&lt;font size=&quot;2&quot;&gt;No Powershell integration (if you’re into that)&lt;/font&gt;&lt;/li&gt; &lt;li&gt;&lt;font size=&quot;2&quot;&gt;No tag support (tagging is basically used for some extra metadata besides the key without pulling the whole object)&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;font size=&quot;2&quot;&gt;So, basically, ALL you get is a simple, Get/Set distributed cache that doesn’t even support the whole set of features you get from the basic ObjectCache in .NET 4.0&lt;/font&gt; &lt;p&gt;&lt;font size=&quot;2&quot;&gt;They really shouldn’t be calling it “AppFabric Cache” at all, since it doesn’t really support anything that comes with that API&lt;/font&gt; &lt;p&gt;&lt;font size=&quot;2&quot;&gt;I must say that I’m &lt;i&gt;really&lt;/i&gt; disappointed&lt;/font&gt; &lt;p&gt;&lt;font size=&quot;2&quot;&gt;We waited a LONG time for this feature and got something that could have been coded in a month.&lt;/font&gt; &lt;p&gt;&lt;font size=&quot;2&quot;&gt;Bad form, Microsoft.&amp;nbsp; Bad form!&lt;/font&gt;&lt;/p&gt;  </description><link>http://codemares.blogspot.com/2011/10/windows-azure-appfabric-cache-miniscule.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4714159983058814272.post-7147333876853488551</guid><pubDate>Wed, 26 Oct 2011 14:00:00 +0000</pubDate><atom:updated>2011-10-26T10:00:02.549-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">azure</category><category domain="http://www.blogger.com/atom/ns#">errors</category><category domain="http://www.blogger.com/atom/ns#">ServiceBus</category><title>Conflicts Between Versions Of Assemblies</title><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;I just upgraded a project from the Azure SDK 1.4 to SDK 1.5.&amp;nbsp; I started getting the &quot;Found conflicts between different versions of the same dependent assembly&quot; warning on the Microsoft.ServiceBus.dll file. &lt;/p&gt; &lt;p&gt;I thought to myself, &quot;Self, I&#39;ve seen this before.&amp;nbsp; You&#39;re just referencing the wrong copy of an assembly somewhere&quot;&lt;/p&gt; &lt;p&gt;So, I checked every reference to Microsoft.ServiceBus.dll … Hmm… they&#39;re all correct. ?? &lt;p&gt;I did a full rebuild… still there.. &lt;p&gt;I did a super-duper clean (close the project, delete every &quot;bin&quot; and &quot;obj&quot; folder, open the project and rebuild)… nope… &lt;p&gt;Time to get medieval on this stuff… So, I opened the topmost assembly (in this case, my Web application assembly) in &lt;a href=&quot;http://wiki.sharpdevelop.net/ILSpy.ashx&quot; target=&quot;_blank&quot;&gt;ILSpy&lt;/a&gt;. I stared looking through each and every referenced assembly until I found the culprit:  &lt;p&gt;&lt;a href=&quot;http://lh5.ggpht.com/-xGNzHKCibA4/TqgSVsaKofI/AAAAAAAAFIA/DOy0KRLtMMc/s1600-h/image%25255B9%25255D.png&quot; target=&quot;_blank&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;http://lh3.ggpht.com/-7AEgrCbO3NU/TqgSXw0rOaI/AAAAAAAAFII/Z7HJ2NEl1OU/image_thumb%25255B5%25255D.png?imgmax=800&quot; width=&quot;644&quot; height=&quot;199&quot;&gt;&lt;/a&gt; &lt;p&gt;Microsoft&#39;s own Transient Fault Handling library (used for retrying database calls in Azure).&amp;nbsp; Now, I&#39;ve contacted the team who wrote that, hoping that they will update their NuGet package.&amp;nbsp; Otherwise, I&#39;ll have to add that ugly Binding Redirect in my config file. &lt;p&gt;For now, I&#39;ll just stare at the warning for a while and hope the NuGet package gets a quick update &lt;img style=&quot;border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none&quot; class=&quot;wlEmoticon wlEmoticon-smile&quot; alt=&quot;Smile&quot; src=&quot;http://lh4.ggpht.com/-tqg9HnJxF8Y/TqgSYQymj8I/AAAAAAAAFIQ/SZQPZ8iRURQ/wlEmoticon-smile%25255B2%25255D.png?imgmax=800&quot;&gt;  </description><link>http://codemares.blogspot.com/2011/10/conflicts-between-versions-of.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-7AEgrCbO3NU/TqgSXw0rOaI/AAAAAAAAFII/Z7HJ2NEl1OU/s72-c/image_thumb%25255B5%25255D.png?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></item></channel></rss>