
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"  xmlns:evnet="http://www.mscommunities.com/rssmodule/" >
    <channel>
        <title>LabNotes - MIX Online</title>
        <description></description>
        <link>http://visitmix.com/LabNotes</link>
        <language>en</language>
        <item>
            <dc:creator>Karsten Januszewski</dc:creator>
            <title>ASP.NET Charts and ASP.NET MVC – Controller vs. View</title>
            <description>&lt;p&gt;Like Hans’ &lt;a href=&quot;http://visitmix.com/LabNotes/Silverlight-Toolkit-Charting-Controls&quot;&gt;most recent lab note&lt;/a&gt;, this one is about charts.&amp;#160; However, my investigations center on a different charting platform: the ASP.NET charting controls.&amp;#160; These are shipping as part of .NET 4.0 and are available for &lt;a href=&quot;http://www.microsoft.com/downloads/details.aspx?FamilyID=130f7986-bf49-4fe5-9ca8-910ae6ea442c&amp;amp;DisplayLang=en&quot;&gt;download&lt;/a&gt; today in .NET 3.5 for free.&amp;#160; You can also &lt;a href=&quot;http://www.microsoft.com/downloads/details.aspx?familyid=1D69CE13-E1E5-4315-825C-F14D33A303E9&amp;amp;displaylang=en&quot;&gt;download VS 2008 tooling support&lt;/a&gt; and &lt;a href=&quot;http://code.msdn.microsoft.com/mschart/Release/ProjectReleases.aspx?ReleaseId=1591&quot;&gt;the ASP.NET and Windows Forms sample projects&lt;/a&gt;, which provide more than 200 samples.&lt;/p&gt;  &lt;p&gt;It appears that there are two architecture options with the charts and ASP.NET MVC, each with pros and cons. &lt;/p&gt;  &lt;h2&gt;Option 1 – Render The Chart As A FileContentResult Through A Controller&lt;/h2&gt;  &lt;p&gt;The first option is to send the chart to the client as a file using the FileContentResult.&amp;#160; This methodology is well explained with sample code in the following blog post: &lt;a href=&quot;http://www.myblogon.net/archive/2009/02/15/21.aspx&quot;&gt;http://www.myblogon.net/archive/2009/02/15/21.aspx&lt;/a&gt;.&amp;#160; It is very clean architecturally and maintains the separations of concerns that is core to the MVC design pattern.&amp;#160; Once you have your controller set up, adding the chart is as simple as adding the route to the &lt;b&gt;src&lt;/b&gt; attribute of an &lt;b&gt;img&lt;/b&gt; tag:&lt;/p&gt;  &lt;pre&gt;&amp;lt;img src=&amp;quot;/Chart/SimpleChart&amp;quot; alt=&amp;quot;Sample Chart&amp;quot; /&amp;gt;&lt;/pre&gt;

&lt;p&gt;Of course, that &lt;b&gt;src&lt;/b&gt; attribute doesn’t have to be static, but could contain parameters generated dynamically, through MVC routing and/or through querystrings, as in the following:&lt;/p&gt;

&lt;pre&gt;&amp;lt;img src=&amp;quot;&amp;lt;%= Url.RouteUrl(&amp;quot;ImageShow&amp;quot;,new&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;                {  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; controller = &amp;quot;Image&amp;quot;,&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;                    action = &amp;quot;Index&amp;quot;,
&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; archive = Model.archive_id,  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; username = Model.User.screen_name,
&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; visualization = ViewData[&amp;quot;Visualization&amp;quot;]  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; } )%&amp;gt;?value=&amp;lt;%=ViewData[&amp;quot;param&amp;quot;]%&amp;gt;&amp;quot; alt=&amp;quot;Chart&amp;quot; /&amp;gt;&lt;/pre&gt;

&lt;p&gt;What’s particularly cool about this methodology is that the page is rendered separately from the images, so you get a kind of asynchronous behavior for free.&lt;/p&gt;

&lt;p&gt;However, there are two drawbacks to this methodology. &lt;/p&gt;

&lt;p&gt;The first is a biggie: you lose interactivity with the chart as far as tooltips, hotspots, hrefs in the charts, etc.&amp;#160; If you only care about serving up an image, option 1 is the way to go. But if you want to take advantage of the interactivity hooks provided by the charts, you’ll need to look into option 2.&lt;/p&gt;

&lt;p&gt;The second is that the chart has to be entirely created via code, as opposed to using markup to instantiate the chart. Why is this an issue? Well, it gets into designer/developer workflow.&amp;#160; I’d much rather let my designer tweak the settings of the chart layout and style. He’s comfortable with tweaking HTML, CSS and XAML, so working the asp:chart xml is totally within his scope.&amp;#160; It means he can mess with settings, hit save, refresh his browser and see his results.&amp;#160; But, if the chart is entirely generated in code, he can’t do that, which means a much less fluid workflow.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;h2&gt;Option 2 – Render The Chart As An ASP.NET Control In the View&lt;/h2&gt;

&lt;p&gt;The second option is to render the chart in the view, either inline in the page or via CodeBehind.&amp;#160; This is well documented in a sample shown in this article: &lt;a href=&quot;http://www.codeproject.com/KB/aspnet/MvcChartControlFileResult.aspx&quot;&gt;http://www.codeproject.com/KB/aspnet/MvcChartControlFileResult.aspx&lt;/a&gt;. By rendering the chart in the view, both of the drawbacks above are mitigated.&amp;#160; You can add interactivity to the chart.&amp;#160; Consider the following Page_Loaded event in CodeBehind of a view:&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;pre&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; protected void Page_Load(object sender, EventArgs e)&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;        {&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;            foreach (DataItem dataItem in ((ChartModel)this.Model).Data)
&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;                string x = dataItem.Name;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;                int y = dataItem.Count;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;                int ptIdx = this.Chart1.Series[0].Points.AddXY(x, y);&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;                DataPoint pt = this.Chart1.Series[0].Points[ptIdx];&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;                pt.LegendText = x + &amp;quot; (&amp;quot; + y + &amp;quot; )&amp;quot;;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;                pt.LegendUrl = &amp;quot;&lt;a href=&quot;http://example.com/&amp;quot;&quot;&gt;http://example.com/&amp;quot;&lt;/a&gt; + x;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;                pt.LegendToolTip = &amp;quot;Click to view &amp;quot; + x + &amp;quot;'s page&amp;quot;;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;                pt.ToolTip = &amp;quot;#VALX: #PERCENT&amp;quot;;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;                pt.Label = &amp;quot;&amp;quot;;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;             }&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;        }&lt;/pre&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;You can see how the controller passes the data to the chart through the model, but the actual databinding happens in the CodeBehind. I found that walking the data and setting each x and y coordinate gives you access to the &lt;b&gt;DataPoint&lt;/b&gt; object, which is where you set things like &lt;b&gt;LegendUrl&lt;/b&gt;, &lt;b&gt;LegendToolTip&lt;/b&gt; and &lt;b&gt;Tooltip&lt;/b&gt; – the very interactivity I was referring to. If you look at the HTML generated after the control renders (via IE8’s Developer Tools for example), you’ll see that the ASP.NET map control will create a &amp;lt;map&amp;gt; element withmultiple child &amp;lt;area&amp;gt; elements that correlate with the image. &lt;/p&gt;

&lt;p&gt;The styling of the chart all happens in the .aspx page:&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;pre&gt;&amp;lt;asp:Chart id=&amp;quot;Chart1&amp;quot; runat=&amp;quot;server&amp;quot; Height=&amp;quot;480&amp;quot; Width=&amp;quot;640&amp;quot; Palette=&amp;quot;BrightPastel&amp;quot; imagetype=&amp;quot;Png&amp;quot; BorderlineDashStyle=&amp;quot;Solid&amp;quot; BackSecondaryColor=&amp;quot;White&amp;quot; BackGradientStyle=&amp;quot;TopBottom&amp;quot; BorderWidth=&amp;quot;2&amp;quot; backcolor=&amp;quot;#D3DFF0&amp;quot; BorderColor=&amp;quot;26, 59, 105&amp;quot;&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;Titles&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;asp:Title Text=&amp;quot;Markup and code behind&amp;quot; /&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/Titles&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;legends&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;asp:Legend IsTextAutoFit=&amp;quot;False&amp;quot; Name=&amp;quot;Default&amp;quot; BackColor=&amp;quot;Transparent&amp;quot; Font=&amp;quot;Trebuchet MS, 8.25pt, style=Bold&amp;quot;&amp;gt;&amp;lt;/asp:Legend&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/legends&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;borderskin skinstyle=&amp;quot;Emboss&amp;quot;&amp;gt;&amp;lt;/borderskin&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;series&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;asp:Series Name=&amp;quot;Column&amp;quot; BorderColor=&amp;quot;180, 26, 59, 105&amp;quot; Legend=&amp;quot;Default&amp;quot; ChartType=&amp;quot;Pie&amp;quot; IsValueShownAsLabel=&amp;quot;false&amp;quot; &amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/asp:Series&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/series&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;chartareas&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;asp:ChartArea Name=&amp;quot;ChartArea1&amp;quot; BorderColor=&amp;quot;64, 64, 64, 64&amp;quot; BorderDashStyle=&amp;quot;Solid&amp;quot; BackSecondaryColor=&amp;quot;White&amp;quot; BackColor=&amp;quot;64, 165, 191, 228&amp;quot; ShadowColor=&amp;quot;Transparent&amp;quot; BackGradientStyle=&amp;quot;TopBottom&amp;quot; &amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;area3dstyle Rotation=&amp;quot;10&amp;quot; perspective=&amp;quot;10&amp;quot; Inclination=&amp;quot;15&amp;quot; IsRightAngleAxes=&amp;quot;False&amp;quot; wallwidth=&amp;quot;0&amp;quot; IsClustered=&amp;quot;False&amp;quot;&amp;gt;&amp;lt;/area3dstyle&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;axisy linecolor=&amp;quot;64, 64, 64, 64&amp;quot;&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;labelstyle font=&amp;quot;Trebuchet MS, 8.25pt, style=Bold&amp;quot; /&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;majorgrid linecolor=&amp;quot;64, 64, 64, 64&amp;quot; /&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/axisy&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;axisx linecolor=&amp;quot;64, 64, 64, 64&amp;quot;&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;labelstyle font=&amp;quot;Trebuchet MS, 8.25pt, style=Bold&amp;quot; /&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;majorgrid linecolor=&amp;quot;64, 64, 64, 64&amp;quot; /&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/axisx&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/asp:ChartArea&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/chartareas&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;lt;/asp:Chart&amp;gt;&amp;#160; &lt;/pre&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;The big drawback? Well, it bends the rules of ASP.NET MVC.&amp;#160; I’m not sure how “evil” this really is though, as both benefits seem to outweigh the bad practice of adding CodeBehind to a view.&lt;/p&gt;</description>
            <evnet:previewtext>Like Hans’ most recent lab note, this one is about charts.&amp;#160; However, my investigations center on a different charting platform: the ASP.NET charting controls.&amp;#160; These are shipping as part of .NET 4.0 and are available for download today in .NET 3.5 for free.&amp;#160; You can also download VS 2008 tooling support and the ASP.NET and Windows Forms sample projects, which provide more than 200 samples.  It appears that there are two architecture options with the charts and ASP.NET MVC, each with pros and cons.   Option 1 – Render The Chart As A FileContentResult Through A Controller </evnet:previewtext> 
            <link>http://visitmix.com/LabNotes/ASPNET-Charts-and-ASPNET-MVC--Controller-vs-View</link>
            <guid isPermaLink="true">http://visitmix.com/LabNotes/ASPNET-Charts-and-ASPNET-MVC--Controller-vs-View</guid>
            <pubDate>Fri, 05 Mar 2010 15:41:56 GMT</pubDate>
        </item>
        <item>
            <dc:creator>Hans Hugli</dc:creator>
            <title>Silverlight Toolkit Charting Controls</title>
            <description>&lt;h2&gt;The Problem with Charting Control Styling&lt;/h2&gt;  &lt;p&gt;Recently, my team needed some basic charting controls for a project we were working on, so I investigated the Silverlight Toolkit charting controls available on &lt;a href=&quot;http://silverlight.codeplex.com/&quot;&gt;CodePlex&lt;/a&gt;. We quickly discovered that the Charting control styling was cumbersome in Expression Blend. I ran into the following issues:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The Toolkit runtime DLLs don’t support editing styling templates &lt;/li&gt;    &lt;li&gt;The Themes approach that the Silverlight Toolkit employs doesn’t have design time support &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;If you’re looking to use the Silverlight Toolkit Charting controls, here are a few options for working around these issues. &lt;/p&gt;  &lt;h2&gt;Getting Ramped Up&lt;/h2&gt;  &lt;p&gt;I was pointed to a good &lt;a href=&quot;http://expression.microsoft.com/en-us/dd433476.aspx&quot;&gt;blog&lt;/a&gt; from December 2008 that describes how to style the charting controls. The blog is written well, but dated—I’ll clarify any inaccuracies below.&lt;/p&gt;  &lt;p&gt;I installed the Silverlight 3 Toolkit with the installer located on the home page of the CodePlex site. I then fired up Blend 3, created a new Silverlight Web project and added references to the Silverlight toolkit binaries: System.Windows.Controls.Datavisualization.Toolkit.dll and System.Windows.Controls.Toolkit.dll. Then I opened up the Assets panel by clicking the chevron on the left hand menu and chose the Chart control by clicking on it, as shown here:&lt;/p&gt;  &lt;p&gt;&lt;img title=&quot;Assets Panel&quot; alt=&quot;Assets Panel&quot; src=&quot;/content/files/assetpanel.png&quot; /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Once I clicked the Chart control, I then created the control on the designer surface by dragging an area on it. It created a &amp;quot;Column&amp;quot; Bar Chart that showed pre-populated data.&lt;/p&gt;  &lt;p&gt;I wanted to create a Pie chart, so I deleted the ColumnSeries node in the “Objects and Timeline” view by selecting it and pressing delete. This left me with an empty chart. I added a PieSeries by dragging one from the Assets panel into the chart control on the design surface; nothing changed visually since the bindings to the data source have not been defined as they were in the default ColumnSeries. I switched to the XAML view in the design window and added bindings to the data source. In order for the PieSeries element to bind to the PointCollection that was created when we created the chart control, I needed to add the following attributes: IndependentValuePath=&amp;quot;X&amp;quot; DependentValuePath=&amp;quot;Y&amp;quot; ItemsSource=&amp;quot;{Binding}&amp;quot; &lt;/p&gt;  &lt;p&gt;This is how the XAML fragment for the chart control appears:&lt;/p&gt;  &lt;pre&gt;&amp;lt;charting:Chart Title=&amp;quot;Chart Title&amp;quot;&amp;gt;

	&amp;lt;charting:Chart.DataContext&amp;gt;

		&amp;lt;PointCollection&amp;gt;

			&amp;lt;Point&amp;gt;1,10&amp;lt;/Point&amp;gt;

			&amp;lt;Point&amp;gt;2,20&amp;lt;/Point&amp;gt;

			&amp;lt;Point&amp;gt;3,30&amp;lt;/Point&amp;gt;

			&amp;lt;Point&amp;gt;4,40&amp;lt;/Point&amp;gt;

		&amp;lt;/PointCollection&amp;gt;

	&amp;lt;/charting:Chart.DataContext&amp;gt;

	&amp;lt;charting:PieSeries Margin=&amp;quot;0&amp;quot; IndependentValuePath=&amp;quot;X&amp;quot;
		DependentValuePath=&amp;quot;Y&amp;quot; ItemsSource=&amp;quot;{Binding}&amp;quot;/&amp;gt;

&amp;lt;/charting:Chart&amp;gt;&lt;/pre&gt;

&lt;p&gt;The chart control can be bound to any data source. In this sample, the PointCollection data is supplied so that the designer will show some basic data on the design surface. &lt;/p&gt;

&lt;h2&gt;Blocking Issue&lt;/h2&gt;

&lt;p&gt;The tutorial I was following assumed that the designer had the Toolkit project’s source code in his or her project, rather than just a reference to the runtime binaries. That is to say, if you simply install the Silverlight Toolkit with the MSI file, adding the necessary binary references to your project will not allow the designer to modify the chart styles. &lt;/p&gt;

&lt;p&gt;Here’s an image (circled in red) that shows that editing a copy of a template of the current selected item is unavailable.&lt;/p&gt;

&lt;p&gt;&lt;img title=&quot;Edit a Copy is disabled&quot; alt=&quot;Edit a Copy is disabled&quot; src=&quot;/content/files/editcopy.png&quot; width=&quot;664&quot; height=&quot;381&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;The Workaround&lt;/h2&gt;

&lt;p&gt;At the time of this writing I still don’t know why the designer behaves this way with runtime binaries, but the workaround is to have the design solution also contain the source code for the Toolkit charting dependencies. You can download the entire Toolkit source code from the &lt;a href=&quot;http://silverlight.codeplex.com/&quot;&gt;homepage&lt;/a&gt; of the CodePlex Silverlight Toolkit project by clicking on the download button, but you don’t need to add all projects to your solution to accomplish the goal.&lt;/p&gt;

&lt;p&gt;Begin by deleting the existing references to the Toolkit runtime assemblies. Then add the following projects to your solution: &lt;b&gt;Controls.Data.Toolkit&lt;/b&gt;, &lt;b&gt;Controls.DataVisualization.Toolkit&lt;/b&gt;, &lt;b&gt;Controls.Input.Toolkit&lt;/b&gt;, &lt;b&gt;Controls.Layout.Toolkit&lt;/b&gt;, &lt;b&gt;Controls.Theming.Toolkit&lt;/b&gt; and &lt;b&gt;Controls.Toolkit&lt;/b&gt;. Lastly, add references to all these projects to the project that contains the page you want to create the chart in. Once you’ve added the references, the “Template Editing” option becomes enabled. From there you can modify the templates in the designer. The design surface will update visually as modifications are made. &lt;/p&gt;

&lt;p&gt;Now it’s also possible to modify the DataPointStyle templates and the LegendItemStyle templates, which allow fine-grained control over how the data points and legend appear.&lt;/p&gt;

&lt;h2&gt;Erratum to Pete’s Blog Post&lt;/h2&gt;

&lt;p&gt;Pete’s blog &lt;a href=&quot;http://expression.microsoft.com/en-us/dd433476.aspx&quot;&gt;post&lt;/a&gt; makes reference to a type: &lt;b&gt;StylePalette&lt;/b&gt;. However, the correct type is &lt;b&gt;Palette&lt;/b&gt;. The type’s name was changed after the December 9&lt;sup&gt;th&lt;/sup&gt;, 2008 release of the Toolkit. At the time of this writing, the version from November 2009 is available. &lt;/p&gt;

&lt;p&gt;Additionally, the path to the namespace reference in the XAML has changed from: &lt;/p&gt;

&lt;pre&gt;xmlns:datavis=&amp;quot;clr-namespace:Microsoft.Windows.Controls.DataVisualization;
	assembly=Microsoft.Windows.Controls.DataVisualization&amp;quot;&lt;/pre&gt;

&lt;p&gt;to:&lt;/p&gt;

&lt;pre&gt;xmlns:datavis=&amp;quot;clr-namespace:System.Windows.Controls.DataVisualization;
	assembly=System.Windows.Controls.DataVisualization.Toolkit&amp;quot;&lt;/pre&gt;

&lt;h2&gt;Themes&lt;/h2&gt;

&lt;p&gt;In theory, the themes support is very nice, since it’s very easy swap out the themes. However, you can’t author the theme ResourceDictionaries in Blend, since Blend doesn’t allow editing the XAML for a ResourceDictionary directly. As a result, you’ll find yourself jumping into the styling for a chart and manually moving it to a ResourceDictionary. Not the best designer experience.&lt;/p&gt;

&lt;h2&gt;Summing Up&lt;/h2&gt;

&lt;p&gt;The Silverlight Toolkit Charting controls work well out of the box, but if you are a designer and would like to restyle them, it will take a bit of work. Here is a &lt;a href=&quot;http://cesso.org/r/DVLinks&quot;&gt;link&lt;/a&gt; to much more useful information about the Silverlight Toolkit. A developer will have an easier time modifying the styling, but developers are not designers and generally can only take the design so far. Be aware that if you decide to use these charting controls, they aren’t particularly Blend-friendly. Perhaps this will change in the future.&lt;/p&gt;

&lt;p&gt;&lt;i&gt;Do you have some designer-friendly charting controls that you can recommend? Silverlight-based or not? Let us know. Leave a comment or if you &lt;/i&gt;&lt;a href=&quot;http://www.twitter.com/mixonline&quot;&gt;&lt;i&gt;tweet&lt;/i&gt;&lt;/a&gt;&lt;i&gt;, follow us on Twitter to learn about new content, opinions and articles.&lt;/i&gt;&lt;/p&gt;</description>
            <evnet:previewtext>Recently, my team needed some basic charting controls for a project we were working on, so I investigated the Silverlight Toolkit charting controls.</evnet:previewtext> 
            <link>http://visitmix.com/LabNotes/Silverlight-Toolkit-Charting-Controls</link>
            <guid isPermaLink="true">http://visitmix.com/LabNotes/Silverlight-Toolkit-Charting-Controls</guid>
            <pubDate>Mon, 01 Mar 2010 17:43:05 GMT</pubDate>
            <category>Development</category>
        </item>
        <item>
            <dc:creator>Karsten Januszewski</dc:creator>
            <title>Incarnate for WordPress Plugin Updated</title>
            <description>&lt;p&gt;We’re excited to announce &lt;a href=&quot;http://wordpress.org/extend/plugins/incarnate-for-wordpress/&quot;&gt;Incarnate for WordPress&lt;/a&gt; version 1.2. Significant work has been done with the plugin to address issues that arose with earlier versions.&amp;#160; Because WordPress theming engine’s flexibility, there were number of cases where the plugin didn’t play nicely with WordPress themes.&amp;#160; We’ve fixed these issues and the plugin will now work as expected with most themes right out of the box.&amp;#160; In fact, we’ve confirmed that Incarnate for WordPress is compatible with the following themes (including the 10 most popular as listed &lt;a href=&quot;http://wordpress.org/extend/themes/browse/popular/&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Arclite 2.02 &lt;/li&gt;    &lt;li&gt;Arjuna X &lt;/li&gt;    &lt;li&gt;Atahualpa 3.4.5 &lt;/li&gt;    &lt;li&gt;Comment Central 1.2.3 &lt;/li&gt;    &lt;li&gt;Constructor 0.7.7 &lt;/li&gt;    &lt;li&gt;Cordobo Green Park 2 0.9.502 &lt;/li&gt;    &lt;li&gt;Dark Wood 1.7 &lt;/li&gt;    &lt;li&gt;Mystique 1.72 &lt;/li&gt;    &lt;li&gt;Inanis Glass 1.3.6 &lt;/li&gt;    &lt;li&gt;LightWord 1.9.6 &lt;/li&gt;    &lt;li&gt;Luxury Press 1.4 &lt;/li&gt;    &lt;li&gt;Lysa 1.2 &lt;/li&gt;    &lt;li&gt;Monochrome 2.7 &lt;/li&gt;    &lt;li&gt;Multi-Color 1.6 &lt;/li&gt;    &lt;li&gt;Organic Theme 1.9 &lt;/li&gt;    &lt;li&gt;P2 1.1.3 &lt;/li&gt;    &lt;li&gt;Piano Black 1.3 &lt;/li&gt;    &lt;li&gt;Pixel 2.0.0 &lt;/li&gt;    &lt;li&gt;WordPress Classic 1.5 &lt;/li&gt;    &lt;li&gt;WordPress Default 1.6 &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Incarnate still doesn’t work by default with some themes—sometimes it takes a little manual tweaking. To address this, we’ve improved our instructions and documentation.&amp;#160; &lt;/p&gt;  &lt;p&gt;One example of a theme that takes additional tweaking is &lt;a href=&quot;http://designdisease.com/blog/compositio-wordpress-theme/&quot;&gt;Composito&lt;/a&gt;, which &lt;a href=&quot;http://visitmix.com/About/tholewis/?team=true&quot;&gt;TommyLee’s&lt;/a&gt; blog, &lt;a href=&quot;http://thespiderking.com/wordpress/&quot;&gt;The Spider King&lt;/a&gt; uses. In this case, we had to change 2 lines to the comments.php file to get Incarnate working. First, we had to change line 28 of comments.php from this: &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;pre&gt;  &amp;lt;p class=&amp;quot;avt&amp;quot;&amp;gt;&amp;lt;img src=&amp;quot;&amp;lt;?php gravatar(&amp;quot;R&amp;quot;, 45, get_bloginfo('template_url').&amp;quot;/images/avatar-replace.png&amp;quot;); ?&amp;gt;&amp;quot; alt=&amp;quot;Avatar&amp;quot; /&amp;gt;&amp;lt;/p&amp;gt;&lt;/pre&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;To this:&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;pre&gt;  &amp;lt;p class=&amp;quot;avt&amp;quot;&amp;gt;&amp;lt;?php if(function_exists('incarnate_for_wordpress_insert_avatar')) { incarnate_for_wordpress_insert_avatar($comment); } ?&amp;gt;&amp;lt;/p&amp;gt;&lt;/pre&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Second, the following line had to be added at line&amp;#160; 62.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;pre&gt;  &amp;lt;?php if(function_exists('incarnate_for_wordpress_insert_ui')) { incarnate_for_wordpress_insert_ui(); } ?&amp;gt; &lt;/pre&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Moving forward, we will document themes which are known to work but require additional tweaks like this.&amp;#160; Let us know if you find one.&lt;/p&gt;</description>
            <evnet:previewtext>We’re excited to announce Incarnate for WordPress version 1.2. Significant work has been done with the plugin to address issues that arose with earlier versions.&amp;#160; Because WordPress theming engine’s flexibility, there were number of cases where the plugin didn’t play nicely with WordPress themes.&amp;#160; We’ve fixed these issues and the plugin will now work as expected with most themes right out of the box.&amp;#160; In fact, we’ve confirmed that Incarnate for WordPress is compatible with the following themes (including the 10 most popular as listed here).     Arclite 2.02     Arjuna X  </evnet:previewtext> 
            <link>http://visitmix.com/LabNotes/Incarnate-for-WordPress-Plugin-Updated</link>
            <guid isPermaLink="true">http://visitmix.com/LabNotes/Incarnate-for-WordPress-Plugin-Updated</guid>
            <pubDate>Tue, 16 Feb 2010 00:49:59 GMT</pubDate>
            <category>Development</category>
            <category>Incarnate</category>
        </item>
        <item>
            <dc:creator>Karsten Januszewski</dc:creator>
            <title>Incarnate Updates: BlogEngine.NET Support and Service Improvements</title>
            <description>&lt;p&gt;We are excited to announce support for &lt;a href=&quot;http://visitmix.com/labs/incarnate&quot;&gt;Incarnate&lt;/a&gt; in the latest &lt;a href=&quot;http://www.dotnetblogengine.net/&quot;&gt;BlogEngine.NET&lt;/a&gt; release. In addition, we have made some improvements to the Incarnate service itself. Here’s the scoop:&lt;/p&gt;  &lt;h2&gt;BlogEngine.NET Support&lt;/h2&gt;  &lt;p&gt;&lt;a href=&quot;http://visitmix.com/Content/Files/benlogo80_21.gif&quot;&gt;&lt;img style=&quot;border-right-width: 0px; margin: 0px 0px 0px 5px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;benlogo80&quot; border=&quot;0&quot; alt=&quot;benlogo80&quot; align=&quot;right&quot; src=&quot;http://visitmix.com/Content/Files/benlogo80_thumb1.gif&quot; width=&quot;266&quot; height=&quot;80&quot; /&gt;&lt;/a&gt; With the release of &lt;a href=&quot;http://www.dotnetblogengine.net/post/BlogEngineNET-16-is-Released.aspx&quot;&gt;BlogEngine.NET 1.6&lt;/a&gt;, Incarnate is now supported.&amp;#160; We worked with &lt;a href=&quot;http://blogengine.codeplex.com/team/view&quot;&gt;the team behind the project&lt;/a&gt; and they added the infrastructure in their engine to support other avatar providers in addition to Gravatar.&amp;#160; Now, they have a field that stores an avatar URL in association with each comment, which works for both their XML provider and their SQL provider.&lt;/p&gt;  &lt;p&gt;While BlogEngine.NET doesn’t support Incarnate out of the box, adding it is a breeze.&amp;#160; It is a simple matter of replacing a single file (/User Controls/CommentView.ascx) and you are good to go.&amp;#160; It works across themes.&amp;#160; You can download the file &lt;a href=&quot;http://visitmix.com/labs/incarnate/IncarnateBlogEngine.zip&quot;&gt;here&lt;/a&gt;. If you’d like to see an example blog that uses Blog Engine.NET with Incarnate, see &lt;a href=&quot;http://rhizohm.net/irhetoric&quot;&gt;http://rhizohm.net/irhetoric&lt;/a&gt;. If you have questions or issues getting Incarnate working with your instance of BlogEngine.NET, let us know and we’ll be happy to help. And, hats off to the BlogEngine.NET team on a great release. &lt;/p&gt;  &lt;h2&gt;Incarnate Service Updates&lt;/h2&gt;  &lt;p&gt;We made two updates to the Incarnate service itself, which is hosted at &lt;a href=&quot;http://incarnate.visitmix.com&quot;&gt;http://incarnate.visitmix.com&lt;/a&gt;.&amp;#160; First, we’ve resolved cases in which the XBoxLive avatar provider returned 404s instead of the default XBoxLive avatar. You’ll no longer see an unattractive “not found” graphic. Second, for people consuming the service directly, the REST API is no longer case sensitive.&amp;#160; &lt;/p&gt;  &lt;p&gt;We also made several updates to the Windows Azure infrastructure, including changing the actual instance used by Azure. Behind the scenes, we pointed the &lt;a href=&quot;http://incarnate.visitmix.com&quot;&gt;http://incarnate.visitmix.com&lt;/a&gt; url to a different Azure instance using &lt;a href=&quot;http://rhizohm.net/irhetoric/post/2010/01/22/The-Importance-of-Using-CNames-with-Windows-Azure.aspx&quot;&gt;cnames&lt;/a&gt;. &lt;/p&gt;</description>
            <evnet:previewtext>We are excited to announce support for Incarnate in the latest BlogEngine.NET release. In addition, we have made some improvements to the Incarnate service itself. Here’s the scoop:  BlogEngine.NET Support   With the release of BlogEngine.NET 1.6, Incarnate is now supported.&amp;#160; We worked with the team behind the project and they added the infrastructure in their engine to support other avatar providers in addition to Gravatar.&amp;#160; Now, they have a field that stores an avatar URL in association with each comment, which works for both their XML provider and their SQL provider.  While BlogEngine.NET doesn’t support Incarnate</evnet:previewtext> 
            <link>http://visitmix.com/LabNotes/Incarnate-Updates</link>
            <guid isPermaLink="true">http://visitmix.com/LabNotes/Incarnate-Updates</guid>
            <pubDate>Fri, 05 Feb 2010 20:06:07 GMT</pubDate>
            <category>Development</category>
            <category>Incarnate</category>
        </item>
        <item>
            <dc:creator>Hans Hugli</dc:creator>
            <title>HTML5 video tag with H.264 codec</title>
            <description>&lt;p&gt;Our implementation of the HTML5 video tag has been tested on both Windows and Mac, using IE, Firefox, Safari, and Chrome.&lt;/p&gt;  &lt;p&gt;To use it, just add a reference to dlrmedia.js at the top of your page.&amp;#160; Visitors to your site will be able to view your H.264 video using the codec that ships with Silverlight.&lt;/p&gt;  &lt;p&gt;Here is a sample, using the YouTube recording of Ian Hickson discussing HTML5 features.&amp;#160; To try it out, copy/paste this code to a new HTML page, and host it on your local web server.&lt;/p&gt;  &lt;p&gt; &amp;lt;!DOCTYPE html&amp;gt;    &lt;br /&gt;&amp;lt;html&amp;gt;    &lt;br /&gt;&amp;lt;head&amp;gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;script src=&amp;quot;http://visitmix.com/dlr/dlr.js&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;script src=&amp;quot;http://visitmix.com/dlr/gestaltmedia.js&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;    &lt;br /&gt;&amp;lt;/head&amp;gt;    &lt;br /&gt;&amp;lt;body&amp;gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;video id=&amp;quot;video1&amp;quot; width=&amp;quot;640&amp;quot; height=&amp;quot;480&amp;quot; volume=&amp;quot;.7&amp;quot; controls autoplay&amp;gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;source src=&amp;quot;http://www.visitmix.com/content/files/HTML5.mp4&amp;quot; type=&amp;quot;video/wmv&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/video&amp;gt;    &lt;br /&gt;&amp;lt;/body&amp;gt;    &lt;br /&gt;&amp;lt;/html&amp;gt;     &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;   We depend on the H.264 decoder that ships with Silverlight, which is widely deployed and easy to install.  It would be equally simple to use Flash instead, and our implementation is not difficult to modify.  You are free to use and modify our source code.  More details at the &lt;a href=&quot;http://visitmix.com/labs/gestalt/widgets/&quot;&gt;Gestalt Widgets&lt;/a&gt; page. &lt;/p&gt; &lt;p&gt;   Click the thumbnail below to see the video. &lt;/p&gt;  &lt;p align=&quot;center&quot;&gt;&lt;a href=&quot;#&quot; class=&quot;inline_video&quot; id=&quot;hiHumans&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;html5video&quot; border=&quot;0&quot; alt=&quot;html5video&quot; src=&quot;http://visitmix.com/Content/Files/html5video_thumb.png&quot; width=&quot;240&quot; height=&quot;170&quot; /&gt;&lt;/a&gt;  &lt;script src=&quot;/dlr/dlr.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;           &lt;script src=&quot;/dlr/gestaltmedia.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;           &lt;link type=&quot;text/css&quot; media=&quot;screen&quot; rel=&quot;stylesheet&quot; href=&quot;/lib/colorbox/colorbox.css&quot; /&gt;           &lt;script src=&quot;/lib/colorbox/jquery-1.3.2.min.js&quot; type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;           &lt;script src=&quot;/lib/colorbox/jquery.colorbox.js&quot; type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;           &lt;script type=&quot;text/javascript&quot;&gt;
            $(document).ready(function() {
                $(&quot;.inline_video&quot;).colorbox({ inline: true, href: &quot;#inline_video&quot; });
            });
&lt;/script&gt;           &lt;div style='display: none'&gt;              &lt;div id='inline_video' style=&quot;overflow: hidden&quot;&gt;                  &lt;video id=&quot;video1&quot; width=&quot;640&quot; height=&quot;480&quot; volume=&quot;.7&quot; controls autoplay&gt;&lt;source src=&quot;http://www.visitmix.com/content/files/HTML5.mp4&quot; type=&quot;video/wmv&quot;&gt;&lt;/source&gt;&lt;/video&gt;              &lt;/div&gt;          &lt;/div&gt;&lt;/p&gt;</description>
            <evnet:previewtext>Our implementation of the HTML5 video tag has been tested on both Windows and Mac, using IE, Firefox, Safari, and Chrome.  To use it, just add a reference to dlrmedia.js at the top of your page.&amp;#160; Visitors to your site will be able to view your H.264 video using the codec that ships with Silverlight.  Here is a sample, using the YouTube recording of Ian Hickson discussing HTML5 features.&amp;#160; To try it out, copy/paste this code to a new HTML page, and host it on your local web server.   &amp;lt;!DOCTYPE html&amp;gt;    &amp;lt;html&amp;gt; </evnet:previewtext> 
            <link>http://visitmix.com/LabNotes/HTML5-video-tag-with-H264-codec</link>
            <guid isPermaLink="true">http://visitmix.com/LabNotes/HTML5-video-tag-with-H264-codec</guid>
            <pubDate>Mon, 25 Jan 2010 22:04:09 GMT</pubDate>
            <category>Web Standards</category>
        </item>
        <item>
            <dc:creator>Karsten Januszewski</dc:creator>
            <title>Downloading and Parsing IIS Logs from Windows Azure</title>
            <description>&lt;p&gt;In this post, I’ll tell you how to get IIS logs out of Windows Azure and onto your local machine so you can do analysis. I wrote a program called AzureLogFetcher to enable this process.&lt;/p&gt;  &lt;p&gt;I &lt;u&gt;&lt;a href=&quot;http://visitmix.com/LabNotes/Adventures-With-Azure-Diagnostics&quot;&gt;have already written&lt;/a&gt;&lt;/u&gt; about how to get logging and diagnostics working with Windows Azure so that you can access both your IIS logs and diagnostic information.&amp;#160; In this post, I’ll show you how to get this information out of Windows Azure and onto your local machine so you can analyze the logs. I’ll also show some of the queries I run against the IIS logs using the most excellent &lt;a href=&quot;http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&amp;amp;displaylang=en&quot;&gt;Log Parser&lt;/a&gt; tool, a free program from Microsoft. &lt;/p&gt;  &lt;p&gt;So, here’s the crux of the problem: you’ve got your website running in Azure. You’ve got Azure transferring the IIS logs across all instances of your site to your Azure storage account. But now, you need to download those logs and do something with them.&amp;#160; There are tools out there that allow you to browse and download these files, but this gets laborious and tedious—after all, there’s a new log file written every hour.&amp;#160; Using a GUI tool to do the job means you have to manually select the log files and then copy them to your local machine. Wouldn’t it be nice if there were a tool that automatically did this for you?&lt;/p&gt;  &lt;p&gt;I took a look and couldn’t find any tools like this.&amp;#160; So, I chatted with &lt;a href=&quot;http://dunnry.com/blog/&quot;&gt;Ryan Dunn&lt;/a&gt;, Windows Azure evangelist extraordinaire. We cooked up &lt;a href=&quot;http://code.msdn.microsoft.com/azurelogfetcher&quot;&gt;Azure Log Fetcher&lt;/a&gt;, a command line application that will download all your IIS logs from Azure and delete them from the cloud. You can create a .bat file and set it in task scheduler to run automatically. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Here’s what it looks like:&lt;/p&gt;  &lt;pre&gt;using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.StorageClient;
using System.Net.Mail;

namespace AzureLogFetch
{
    class Program
    {
        static string smtp = null;
        static string email = null;
        
        static void Main(string[] args)
        {
            if (args.Count() &amp;lt; 3)
            {
                Console.WriteLine(&amp;quot;Usage: AzureLogFetch [path to save files] 
			[Azure instance name] [Azure key] [smtp port] 
			[email]&amp;quot;);
                Console.WriteLine(@&amp;quot;Note: smtpport and email are optional&amp;quot;);
                Console.WriteLine(@&amp;quot;Example w/o email:&amp;quot;);
                Console.WriteLine(@&amp;quot;Example: AzureLogFetch g:\logs MyAzure 
			EK247tO8q4aNLA+A==&amp;quot;);
                Console.WriteLine(@&amp;quot;Example w/ email: AzureLogFetch g:\logs
			MyAzure EK247tO8q4aNLA+A== smtp.mymail.com me@email.com&amp;quot;);
                return;
            }
            string directory = args[0];
            string instance = args[1];
            string key = args[2];

            if (args.Count() &amp;gt; 3)
            {
                smtp = args[3];
                email = args[4];
            }
            var account = new CloudStorageAccount(
        new StorageCredentialsAccountAndKey(
            instance,
            key
            ),
        false
        );

            var client = account.CreateCloudBlobClient();
            var container = client.GetContainerReference(&amp;quot;wad-iis-logfiles&amp;quot;);

            //note that I pass the BlobRequestOptions of UseFlatBlobListing 
	    //which returns all files regardless 
            //of nesting so that I don't have to walk the directory structure
            foreach (var blob in container.ListBlobs(new 
		BlobRequestOptions() { UseFlatBlobListing = true }))
            {
                CloudBlob b = blob as CloudBlob;
                try
                {
                    b.FetchAttributes();
                    BlobAttributes blobAttributes = b.Attributes;
                    TimeSpan span = DateTime.Now.Subtract
			(blobAttributes.Properties.LastModifiedUtc.ToLocalTime());
                    int compare = TimeSpan.Compare(span, TimeSpan.FromHours(1));
                    //we don't want to download and delete the latest  
		    //log file, because it is incomplete and still being
                    //written to, thus this compare logic
                    if (compare == 1)
                    {
                        b.DownloadToFile(directory + b.Uri.PathAndQuery);
                        b.Delete();
                    }
                }
                catch (Exception e)
                {
                    SendMail(instance + &amp;quot; download of logs failed!!!!&amp;quot;, 
			e.Message);
                    return;
                }

            }
            SendMail(instance + &amp;quot; download of logs complete 
		at &amp;quot; + DateTime.Now.ToLongDateString() + &amp;quot; &amp;quot; + 
		DateTime.Now.ToShortTimeString() , &amp;quot;&amp;quot;);


        }
        static void SendMail(string subject, string body)
        {
            if (smtp == null || email == null)
            {
                return;
            }
            MailMessage message = new MailMessage();
            SmtpClient smtpClient = new SmtpClient(smtp, 25);
            message.From = new MailAddress(email);
            message.To.Add(new MailAddress(email));
            message.Subject = subject;
            message.Body = body;
            smtpClient.UseDefaultCredentials = true;
            smtpClient.Send(message);

        }
    }
}&lt;/pre&gt;

&lt;p&gt;There are a few things worth commenting on about this code. First, you’ll notice it requires Microsoft.WindowsAzure and Microsoft.WindowsAzure.StorageClient.&amp;#160; These are assemblies that ship with the &lt;a href=&quot;http://www.microsoft.com/downloads/details.aspx?FamilyID=6967ff37-813e-47c7-b987-889124b43abd&amp;amp;displaylang=en&quot;&gt;Windows Azure Tools for Microsoft Visual Studio (November 2009)&lt;/a&gt; as part of the Windows Azure SDK. You can find them at %Program Files%\Windows Azure SDK\v1.0\ref.&lt;/p&gt;

&lt;p&gt;The crux line (thanks Ryan!) is where I iterate over the log files:&lt;/p&gt;

&lt;pre&gt;foreach (var blob in container.ListBlobs(new BlobRequestOptions() { UseFlatBlobListing = true })) &lt;/pre&gt;

&lt;p&gt;The key here is that I pass the UseFlatBlobListing option, which means I don’t have to walk the whole directory structure to get all the logs across all instances.&amp;#160; Rather, it returns me everything—which means every log file.&amp;#160; This turns out to be handy when I go to download the file here:&lt;/p&gt;

&lt;pre&gt;b.DownloadToFile(directory + b.Uri.PathAndQuery); &lt;/pre&gt;

&lt;p&gt;Notice I’m able to preserve the path. This is clutch because, if you are running multiple instances in Azure, you’ll have log files with the same name from different instances (aka u_ex10011916.log), so the files need to be saved in paths unique to their instance.&lt;/p&gt;

&lt;p&gt;The other thing I did was to make sure I didn’t download the log file currently being written to. After all, it is a living document; if I were to download it, I might miss some of the logging it did (and thus the comparison logic in the code). After downloading them, I go ahead and blow them away. &lt;/p&gt;

&lt;p&gt;I also added some code that enables the program to send an email after either a successful transfer of the logs or a failure.&lt;/p&gt;

&lt;p&gt;You can cut/paste/compile this yourself or &lt;a href=&quot;http://code.msdn.microsoft.com/azurelogfetcher&quot;&gt;download the source or the binary here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Once you have all this IIS log data, what do you do with it?&amp;#160; You analyze it, of course. The best tool I’ve found for analyzing IIS logs is the &lt;a href=&quot;http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&amp;amp;displaylang=en&quot;&gt;Microsoft Log Parser tool&lt;/a&gt;.&amp;#160; This is a command line tool that allows you write SQL queries against your log files.&amp;#160; The query I find myself returning to again and again is as follows:&lt;/p&gt;

&lt;pre&gt;logparser -i:IISW3C &amp;quot;SELECT count(*) as hits, cs(referer) INTO referrer.txt FROM *.log WHERE cs-uri-stem not like '%.png' and cs-uri-stem not like '%.gif' group by cs(Referer) order by hits desc&amp;quot; -recurse -o:CSV&lt;/pre&gt;

&lt;p&gt;This query groups referrers by hits, allowing me to see where my traffic is coming from. This is key for the Incarnate service, since we’re trying to determine who has installed the Incarnate plug-in. Notice that I exclude any .png or .gif files from the query, so I’m only getting hits on the service itself. By passing the O:csv switch, I can easily pull this into Excel and then sum the count column to get my total hits. If you want, you can also have it generate nifty charts for you, like this:&lt;/p&gt;

&lt;pre&gt;logparser -i:IISW3C &amp;quot;SELECT count(*) as hits, cs(referer) INTO chart.gif FROM *.log WHERE cs-uri-stem not like '%.png' and cs-uri-stem not like '%.gif' group by cs(Referer) order by hits desc&amp;quot; -recurse -o:Chart –chartType:Pie3D&lt;/pre&gt;

&lt;p&gt;I should note that I got the following error when I tried to generate charts:&lt;/p&gt;

&lt;pre&gt;&lt;em&gt;Error creating output format &amp;quot;chart&amp;quot;: This output format requires a licensed Microsoft Office Chart Web Component to be installed on the local machine.&lt;/em&gt;&lt;/pre&gt;

&lt;p&gt;Turns out I needed to install some Office components which may not be on your system. See &lt;a href=&quot;http://blogs.msdn.com/carloc/archive/2008/08/07/charting-with-logparser.aspx&quot;&gt;this blog post&lt;/a&gt; for more. &lt;/p&gt;

&lt;p&gt;There are a bunch of great samples that ship with Log Parser. The SDK and their &lt;a href=&quot;http://forums.iis.net/default.aspx?GroupID=51&quot;&gt;forums&lt;/a&gt; are also helpful. &lt;/p&gt;</description>
            <evnet:previewtext>In this post, I delve into how to get IIS logs out of Windows Azure and on to your local machine so you can do analysis. I wrote a program to help this process called AzureLogFetcher.</evnet:previewtext> 
            <link>http://visitmix.com/LabNotes/Downloading-and-Parsing-IIS-Logs-from-Windows-Azure</link>
            <guid isPermaLink="true">http://visitmix.com/LabNotes/Downloading-and-Parsing-IIS-Logs-from-Windows-Azure</guid>
            <pubDate>Sat, 23 Jan 2010 00:23:46 GMT</pubDate>
            <category>Development</category>
            <category>Windows Azure</category>
        </item>
        <item>
            <dc:creator>Karsten Januszewski</dc:creator>
            <title>Introducing Incarnate</title>
            <description>&lt;p&gt;We're excited to release &lt;a href=&quot;http://visitmix.com/labs/incarnate/&quot;&gt;Incarnate&lt;/a&gt;, a new lab from Mix Online. Included with this lab are a great set of articles that deal with &lt;a href=&quot;http://visitmix.com/Articles/Web-Forms-for-People&quot;&gt;how to design web forms&lt;/a&gt; and—a first for Mix Online—&lt;a href=&quot;http://visitmix.com/LabNotes/WP-Incarnate-On-Building-A-Word-Press-Plug-In-For-Incarnate&quot;&gt;how we built a Word Press plug-in&lt;/a&gt; for a better experience handling avatars on the web.&lt;/p&gt;  &lt;p&gt;So, what exactly is Incarnate? It's a service that you can incorporate into your blog or website that allows your users to associate themselves with an avatar they've already published on the web. &lt;a href=&quot;http://visitmix.com/labs/incarnate/&quot;&gt;Try it out now&lt;/a&gt;.&lt;/p&gt;  &lt;h2&gt;The Genesis of Incarnate&lt;/h2&gt;  &lt;p&gt;So, what motivated us to build Incarnate? Well, first off, avatars are ubiquitous on the web today. Humans are &amp;quot;visual creatures,&amp;quot; and we make associations quickly and assign meaning by processing visual data—especially faces. Using avatars, users can establish a consistent visual identity to associate with their &amp;quot;virtual selves.&amp;quot; So, if you run a website, supporting avatars is a good thing.&lt;/p&gt;  &lt;p&gt;But, have you ever been to a webpage or blog and looked at the comments and seen an array of “default” avatars next to the comments? Maybe something like this:&lt;/p&gt;  &lt;p&gt;&lt;img title=&quot;noavatar&quot; border=&quot;0&quot; alt=&quot;noavatar&quot; src=&quot;http://visitmix.com/Content/Files/noavatar_3.png&quot; width=&quot;80&quot; height=&quot;80&quot; /&gt;&amp;#160; &lt;img title=&quot;default_gravatar&quot; border=&quot;0&quot; alt=&quot;default_gravatar&quot; src=&quot;http://visitmix.com/Content/Files/default_gravatar_3.gif&quot; width=&quot;80&quot; height=&quot;80&quot; /&gt; &lt;img title=&quot;d41d8cd98f00b204e9800998ecf8427e&quot; border=&quot;0&quot; alt=&quot;d41d8cd98f00b204e9800998ecf8427e&quot; src=&quot;http://visitmix.com/Content/Files/d41d8cd98f00b204e9800998ecf8427e_3.png&quot; width=&quot;80&quot; height=&quot;80&quot; /&gt; &lt;img title=&quot;thumbnailCA02FK7D&quot; border=&quot;0&quot; alt=&quot;thumbnailCA02FK7D&quot; src=&quot;http://visitmix.com/Content/Files/thumbnailCA02FK7D_3.jpg&quot; width=&quot;64&quot; height=&quot;80&quot; /&gt; &lt;img title=&quot;thumbnailCAMLGGEA&quot; border=&quot;0&quot; alt=&quot;thumbnailCAMLGGEA&quot; src=&quot;http://visitmix.com/Content/Files/thumbnailCAMLGGEA_3.jpg&quot; width=&quot;80&quot; height=&quot;80&quot; /&gt; &lt;/p&gt;  &lt;p&gt;Annoying.&lt;/p&gt;  &lt;p&gt;Most often, these “default” avatars show up when a user doesn’t actually register an avatar with the website (or with the avatar service that website uses).&lt;/p&gt;  &lt;p&gt;Now, have you ever been asked to upload an avatar when trying to register for an website? And you are thinking to yourself, haven’t I uploaded this same avatar to Twitter, MySpace and YouTube already? Can’t I somehow reuse that avatar?&lt;/p&gt;  &lt;p&gt;Again, annoying. These were the scenarios that kept us up at night and inspired us to build Incarnate. &lt;/p&gt;  &lt;p&gt;I was working with &lt;a href=&quot;http://visitmix.com/lab/oomph&quot;&gt;microformats&lt;/a&gt; when it hit me: all the big social networking sites support the hCard microformat on their publically available profile pages. And, most support vanity urls, where the username is part of the friendly url. Thus, we could write a service that parsed these profile pages. Then we could present these avatars to users, and let them pick the avatar they want. We’d solve both the problems discussed above: users would be more likely to use an avatar, which would result in fewer “default” avatars and make for better-looking web pages. And, users wouldn’t have to keep re-uploading their avatar to the same services; instead, they could use their social network of choice as an avatar provider. &lt;/p&gt;  &lt;p&gt;Why did we call it Incarnate? Well, the word incarnate is closely tied to the word avatar. To incarnate means to give something bodily form. In religions, an avatar is the human incarnation of a deity. So, in order to help manifest avatars on websites, our service was aptly named Incarnate.&lt;/p&gt;  &lt;h2&gt;Using Incarnate&lt;/h2&gt;  &lt;p&gt;It's easy to incorporate Incarnate into websites and blogs. If you're using WordPress, you can add the Incarnate WordPress plug into your blog, and users will be able to use the service immediately. If you're using another engine for your website, download the simple sample we put together, which demonstrates how to incorporate Incarnate into an existing website. You may have to write a little code, but it shouldn’t be too bad. (And if you're struggling, don’t hesitate to contact us!)&lt;/p&gt;  &lt;p&gt;If you deploy Incarnate to your website, let us know and we'll feature you!&lt;/p&gt;  &lt;p&gt;You also have the option of interfacing directly with the Incarnate service. The Incarnate service supports JSON and JSON-P through a very simple REST syntax. You can read about the end points and data structures supported by Incarnate &lt;a href=&quot;http://incarnate.visitmix.com/&quot;&gt;here&lt;/a&gt;. And, if you write a user interface using the service or a plug-in that works with Incarnate, let us know so we can feature it.&lt;/p&gt;  &lt;h2&gt;The Technical Details&lt;/h2&gt;  &lt;p&gt;Incarnate is a REST-based service that uses people's usernames to find their avatars on the web. It supports JSON with Padding (JSON-P), so it can be called from any domain. It's written in Windows Communication Foundation (WCF) using the &lt;a href=&quot;http://www.asp.net/downloads/starter-kits/wcf-rest/&quot;&gt;REST Starter Kit&lt;/a&gt; in combination with the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/cc716898.aspx&quot;&gt;JSON-P encoder&lt;/a&gt; that ships as an extensibility sample with the WCF samples. &lt;/p&gt;  &lt;p&gt;We have deployed an instance of Incarnate to Windows Azure, so it scales well. This instance is hosted at &lt;a href=&quot;http://incarnate.visitmix.com/&quot;&gt;http://incarnate.visitmix.com&lt;/a&gt;. You also have the option of deploying an instance of Incarnate to your own server. You can download the source code &lt;a href=&quot;http://code.msdn.microsoft.com/incarnate&quot;&gt;here&lt;/a&gt;. You’ll see that the Incarnate infrastructure supports a provider model, so new providers can be easily added—as long as they conform to the very simple IProvider interface. So, for example, if someone wanted to make a Flickr provider (Flickr has publicly accessible avatars), they could do so. (If you write a new avatar provider, let us know so we can deploy it to our instance of Incarnate). &lt;/p&gt;  &lt;p&gt;Additional documentation about writing a provider is available in the source code to the Incarnate service itself.&lt;/p&gt;  &lt;h2&gt;Incarnate On Channel9&lt;/h2&gt;  &lt;p&gt;&lt;a href=&quot;http://channel9.msdn.com/posts/Charles/Karsten-Januszewski-and-Tim-Aidlin-Introducing-Incarnate/&quot;&gt;Check out this interview&lt;/a&gt; Tim Aidlin and I did for Channel9 with the &lt;a href=&quot;http://channel9.msdn.com/Niners/Charles/&quot;&gt;venerable Charles Torre&lt;/a&gt; about Incarnate.&lt;/p&gt;</description>
            <evnet:previewtext>Our latest lab, &lt;a href=&quot;http://www.visitmix.com/labs/incarnate&quot;&gt;Incarnate&lt;/a&gt;, finds your avatars around the web, so you don’t have to upload a new one every time you join a service or leave a comment.</evnet:previewtext> 
            <link>http://visitmix.com/LabNotes/Incarnate-Find-and-Reuse-Your-Avatars</link>
            <guid isPermaLink="true">http://visitmix.com/LabNotes/Incarnate-Find-and-Reuse-Your-Avatars</guid>
            <pubDate>Tue, 15 Dec 2009 04:58:00 GMT</pubDate>
            <category>News</category>
            <category>Incarnate</category>
        </item>
        <item>
            <dc:creator>Vicky Tamaru</dc:creator>
            <title>A Word Press Plug In For Incarnate</title>
            <description>&lt;h2&gt;Managing Your Avatars &lt;/h2&gt;  &lt;p&gt;These days, most people keep profiles on a number of popular sites like Facebook, MySpace, Windows Live, and Twitter. Dealing with all these profiles—and especially their accompanying avatars—can be tricky. &lt;/p&gt;  &lt;p&gt;There are a couple of services that make managing avatars easy. One is &lt;a href=&quot;http://gravatar.com&quot;&gt;Gravatar&lt;/a&gt;, which makes your avatar available all over the web by taking advantage of the unique email IDs that WordPress uses. &lt;/p&gt;  &lt;p&gt;The other is Incarnate, a service that &lt;a href=&quot;http://visitmix.com/about/karstenj&quot;&gt;Karsten Januszewski&lt;/a&gt; and the Mix Online team built, which searches the web for your avatars based on a handle or email address you use. Simply type in your handle or email address, and it will deliver all the avatars you’ve been using across the most popular social networking sites. &lt;/p&gt;  &lt;p&gt;Gravatar is already integrated with WordPress but until recently, Incarnate was not. To fix this, MIX Online asked us to help them build a WordPress plug-in. Below is a summary of how we did it. &lt;/p&gt;  &lt;p&gt;But first, a note on WordPress. &lt;/p&gt;  &lt;h2&gt;What’s WordPress? &lt;/h2&gt;  &lt;p&gt;WordPress is open-source blog software that's used by a huge number of people across the web. Its open architecture and built-in tools allow you to quickly install plug-ins that make your blog do nearly anything you can think of. It provides a great, ready-to-use experience right out of the box. &lt;/p&gt;  &lt;p&gt;A blog and comment engine are at the core of WordPress. The blog offers a nice rich editor and a wide range of posting options. The commenting feature allows blog readers to fill out a small form with their email (kept hidden) as their unique ID. &lt;/p&gt;  &lt;p&gt;WordPress provides a whole array of points with which you can integrate plug-ins. You can easily add your own settings pages, widgets, and metadata or add markup, styles, and scripts to the site. If you want to learn more, the WordPress.org site has extensive documentation on the usage of each API call and plug-in function. There is also an active community of developers and contributors in the development forums. &lt;/p&gt;  &lt;h2&gt;Our Incarnate Plug-in for WordPress &lt;/h2&gt;  &lt;p&gt;We wanted our plug-in to do two things: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Allow the user to select an avatar from Incarnate. &lt;/li&gt;    &lt;li&gt;Display the avatar next to the user’s comment &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Selecting an Avatar&lt;/h3&gt;  &lt;p&gt;To allow the user to select an avatar, we used a tidy AJAX GUI. The user simply enters his or her handle in the box and selects an avatar from the graphic list. WordPress provides a nice hook for the comment form that allows us to add HTML to the page when the comment form is rendered. We used that opportunity to write a quick jQuery script that injects our GUI into the document right at the top of the form. &lt;/p&gt;  &lt;p&gt;Once the user selects an avatar, we need to make sure its stored and associated with the content. This process is fairly straightforward and well documented. You simply add an API hook to validate the comment data. We used that validation opportunity to store the avatar URL in a database table for retrieval later. &lt;/p&gt;  &lt;h3&gt;Displaying the Avatar &lt;/h3&gt;  &lt;p&gt;As we dove into the docs, we realized we could override a variety of &amp;quot;pluggable&amp;quot; functions in WordPress. One of these was for displaying avatars. Any time an avatar would normally be displayed, we tell it to override with the URL from our own database record! &lt;/p&gt;  &lt;p&gt;And just like that, WordPress users can now add great avatars for their comments without having to dig through their files for their favorite headshot. Even better, their avatar is updated dynamically based on the default avatar so that when a better photo comes along, they don’t have to update all across the many WordPress blogs they visit. Users have the flexibility of finding avatars from a wide range of sites—all through the Incarnate service. &lt;/p&gt;  &lt;h3&gt;Gravatar Preview &lt;/h3&gt;  &lt;p&gt;But we decided to go one step further. What about users who don't want to pull in their avatar and just want to post? Well, by default, WordPress would seek out their gravatar. After they've posted their comment they would see a gravatar on the page—but they'd never get to preview it. We used the logic built in to WordPress to pull in a nice preview of your gravatar after you've filled out your email address in the standard comment form. &lt;/p&gt;  &lt;h3&gt;Turning Off Auto-Incarnate &lt;/h3&gt;  &lt;p&gt;Lastly, we know that there is a huge range of WordPress templates across the internet. Users are adding new ones daily. What happens if they aren't following the WordPress best practices described in the documentation? We offer the blog owner the option of turning off the automatic Incarnate form and give them template tags they can integrate themselves. &lt;/p&gt;  &lt;h3&gt;Plays Well With Others&lt;/h3&gt;  &lt;p&gt;We've put together a plug-in that truly plays well with others. It uses the best practices outlined in the WordPress blogs and the latest jQuery and AJAX functionality to provide a seamless user experience—and greatly enhances the commenting experience for WordPress readers.&lt;/p&gt;</description>
            <evnet:previewtext>Managing Your Avatars   These days, most people keep profiles on a number of popular sites like Facebook, MySpace, Windows Live, and Twitter. Dealing with all these profiles—and especially their accompanying avatars—can be tricky.   There are a couple of services that make managing avatars easy. One is Gravatar, which makes your avatar available all over the web by taking advantage of the unique email IDs that WordPress uses.   The other is Incarnate, a service that Karsten Januszewski and the Mix Online team built, which searches the web for your avatars based on a handle or</evnet:previewtext> 
            <link>http://visitmix.com/LabNotes/WP-Incarnate-On-Building-A-Word-Press-Plug-In-For-Incarnate</link>
            <guid isPermaLink="true">http://visitmix.com/LabNotes/WP-Incarnate-On-Building-A-Word-Press-Plug-In-For-Incarnate</guid>
            <pubDate>Mon, 14 Dec 2009 20:00:00 GMT</pubDate>
            <category>Development</category>
            <category>Incarnate</category>
        </item>
        <item>
            <dc:creator>Karsten Januszewski</dc:creator>
            <title>Adventures With Windows Azure Diagnostics</title>
            <description>&lt;p&gt;I recently took the Azure plunge, in preparation for an upcoming Mix Online Service we will be announcing soon. Things went relatively smoothly, but I hit few gotchas, especially when trying to get diagnostics and logging working.&amp;#160; Below is a chronicle of said gotchas, with tips on how to resolve them.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Getting Started&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;To learn how to use the new diagnostics features in Windows Azure, I’d would recommend checking out &lt;a href=&quot;http://blogs.msdn.com/windowsazure/archive/2009/12/01/introducing-windows-azure-diagnostics.aspx&quot;&gt;the following blog post first&lt;/a&gt;. Next, there are some great samples that will help you get started:&lt;/p&gt;  &lt;p&gt;1.&amp;#160;&amp;#160;&amp;#160; The tutorial on Channel9 at &lt;a href=&quot;http://channel9.msdn.com/learn/courses/Azure/Deployment/DeployingApplicationsinWindowsAzure/Exercise-3-Monitoring-Applications-in-Windows-Azure/&quot;&gt;http://channel9.msdn.com/learn/courses/Azure/Deployment/DeployingApplicationsinWindowsAzure/Exercise-3-Monitoring-Applications-in-Windows-Azure/&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;2.&amp;#160;&amp;#160;&amp;#160; The Windows Azure SDK sample HelloFabric, which you can find as a vb or c# sample under Program Files\Windows Azure SDK\v1.0\samples-cs\HelloFabric&lt;/p&gt;  &lt;p&gt;There was also a great session about diagnostics at PDC that is well worth watching:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://microsoftpdc.com/Sessions/SVC15&quot;&gt;&lt;img src=&quot;http://blogs.msdn.com/blogfiles/windowsazure/WindowsLiveWriter/IntroducingWindowsAzureDiagnostics_BF26/image_5.png&quot; /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;However, even with all these resources, I still had some problems getting going, so I wanted to document my experience below.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Creating a Store In the Cloud &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You have to explicitly create a store for your diagnostic information in the cloud. This was confusing to me, because you don’t have to set up anything when doing diagnostics in the local development environment—your logs get saved to the file system and your trace messages get saved to SQL Express. &lt;/p&gt;  &lt;p&gt;To get your diagnostic information saved to the cloud, you need to create a storage account up at &lt;a href=&quot;http://windows.azure.com/&quot;&gt;http://windows.azure.com&lt;/a&gt;.&amp;#160; Note that this is different from SQL Azure. You don’t need to create a SQL Azure database; you need to create a storage account under the &lt;i&gt;Windows Azure &lt;/i&gt;tab.&lt;/p&gt;  &lt;p&gt;Once you create your storage account, you need to note the access key and then create a new connection string for your diagnostics store. It's tricky to find, but Visual Studio provides a nifty dialog to help you do so. (This is explained extremely well in Exercise three of the tutorial on Channel9 that I mentioned above, so be sure to read it.)&lt;/p&gt;  &lt;p&gt;Once you change your connection string, all your diagnostics will be saved to the cloud instead of to local storage, even when you're doing local development.&amp;#160; It's easy to flip your connection string back to the development connection string if you like, so you don’t pollute your store with development diagnostics.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Transferring Diagnostics and Logs to the Store&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Once you set up your store, you need to change your application to transfer its diagnostics and logs to the store itself (Again, see the tutorial).&amp;#160; To do this, first add some code to the constructor of the WebRole or WorkerRole. Then, if you want to log failed requests, update your web.config file. Finally, use System.Diagnostics.Trace.TraceError(), .TraceWarning() or .TraceInformation() if you want to output diagnostics from within your code, &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Viewing Diagnostics Information&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Seeing the diagnostics information was another problem I ran into.&amp;#160; I had a store in the cloud, but couldn't get at the data in the store! &lt;/p&gt;  &lt;p&gt;There are APIs that let you get at this data, but you may not want to write code. I found a few tools that helped me get around this: one is &lt;a href=&quot;http://myazurestorage.com/&quot;&gt;http://myazurestorage.com/&lt;/a&gt;. It's nifty, but you can’t see blobs, which is how the IIS logs are stored. That's a show stopper for me. The Codeplex project has a slightly better tool, &lt;a href=&quot;http://azurestorageexplorer.codeplex.com/&quot;&gt;http://azurestorageexplorer.codeplex.com&lt;/a&gt;, but it also some issues with dealing with blobs. I finally found &lt;a href=&quot;http://www.cerebrata.com/&quot;&gt;http://www.cerebrata.com&lt;/a&gt;—a really great tool that's excellent for downloading blobs, as well as reading the diagnostic trace information from my service.&amp;#160; Definitely check this tool out!&amp;#160; Word on the street is that they will be releasing a new version soon with even more features, making this an essential tool when working with Windows Azure.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Getting Everything to Work&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;The last problem I had was getting everything to work. Once everything was running in the development environment but saved to the cloud, I upgraded my service to production in Azure.&amp;#160; Nothing worked. Ultimately, I deleted and recreated the service. This did the trick. Even in the cloud, sometimes a “reboot” is the only answer.&lt;/p&gt;  &lt;p&gt;I’m now set! I can access my IIS logs and get at the diagnostic trace information peppered throughout my code.&amp;#160; Nice! Thanks to everyone who helped me up on the active and helpful &lt;a href=&quot;http://social.msdn.microsoft.com/Forums/en-US/windowsazure/threads&quot;&gt;Windows Azure forums&lt;/a&gt;.&lt;/p&gt;</description>
            <evnet:previewtext>I recently took the Azure plunge, in preparation for an upcoming Mix Online Service we will be announcing soon. Things went relatively smoothly, but I hit few gotchas, especially when trying to get diagnostics and logging working.&amp;#160; Below is a chronicle of said gotchas, with tips on how to resolve them.  Getting Started  To learn how to use the new diagnostics features in Windows Azure, I’d would recommend checking out the following blog post first. Next, there are some great samples that will help you get started:  1.&amp;#160;&amp;#160;&amp;#160; The tutorial on Channel9 at http://channel9.msdn.com/learn/courses/Azure/Deployment/DeployingApplicationsinWindowsAzure/Exercise-3-Monitoring-Applications-in-Windows-Azure/   2.&amp;#160;&amp;#160;&amp;#160;</evnet:previewtext> 
            <link>http://visitmix.com/LabNotes/Adventures-With-Azure-Diagnostics</link>
            <guid isPermaLink="true">http://visitmix.com/LabNotes/Adventures-With-Azure-Diagnostics</guid>
            <pubDate>Fri, 04 Dec 2009 18:31:16 GMT</pubDate>
            <category>Development</category>
            <category>Windows Azure</category>
        </item>
        <item>
            <dc:creator>Hans Hugli</dc:creator>
            <title>Using the HTML5 Video and Audio Tag with Gestalt</title>
            <description>&lt;p&gt;It's true: Gestalt enables you to implement HTML5 video and audio tags. With just a little bit of JavaScript, Gestalt parses out media tags and injects all the HTML you need to embed a video or audio application. The Gestalt media player is also open source and customizable. Check it out at &lt;a href=&quot;http://gestalt.codeplex.com&quot;&gt;http://gestalt.codeplex.com&lt;/a&gt;. &lt;p&gt;&lt;strong&gt;Cross-Platform Support&lt;/strong&gt; &lt;p&gt;Gestalt supports a media player that can play a list of media files in all browsers that support Silverlight—this means IE, Firefox, Chrome and Safari. Extend the Media Player &lt;p&gt;Since we shipped the media player, I've added support for a button that shows/hides captions and simple &lt;a href=&quot;http://www.section508.gov/|&quot;&gt;508&lt;/a&gt; support. &lt;p&gt;All the code + XAML can (but is not required to) reside in a single location, on a different domain than the player. This means that when changes are made to the underlying player code + XAML on the remote server, all players that point to those remote files are automatically updated with the new functionality and UI, which makes for a great web developer experience!  &lt;p&gt;For now, the player code is available on VisitMix.com with a default implementation of the media player. But you can also place and modify your own versions of the code + XAML on your domain, and have all media players that point to your domain's files take on the UI and behavior of your version of the player. &lt;p&gt;&lt;strong&gt;Customize the Media Player for Your Domain&lt;/strong&gt; &lt;p&gt;You can change the appearance of the media player by simply modifying the media.xaml file using a text editor or Expression Blend.  &lt;p&gt;You can also add functionality to the Media player. Let’s say, for instance, that you want to create an audio player that plays stations from &lt;a href=&quot;http://last.fm/&quot;&gt;last.fm&lt;/a&gt;. Begin by adding a text field in the media.xaml. Then, add some classes that enable accessing &lt;a href=&quot;http://last.fm/&quot;&gt;last.fm&lt;/a&gt; API’s to the media.py file based on the textbox input—you now have a media player with new functionality. &lt;p&gt;&lt;strong&gt;Encode your Files in one Easy Step&lt;/strong&gt; &lt;p&gt;In order for the media.py and media.xaml files to work cross domain, they need to be encoded into a JavaScript file using the &lt;a href=&quot;http://www.visitmix.com/dlr/convert.html&quot;&gt;conversion tool&lt;/a&gt;. This tool simply converts the Python and XAML into a format that can be injected into a remote page.  &lt;p&gt;To get started, type the original name of the file in the filename textbox in the convert tool. For example if it was media.py type “media.py” in the textbox, without the quotes. Click the convert button and paste the resulting JavaScript in the bottom textbox into a file with the same name of the original file, with a .js extension. In the case of media.py, paste the code into a file named media.py.js. Do the same for the media.xaml file. &lt;p&gt;Once you've converted the files, replace the files of the same name in the DLR directory. Make a request to your media player, and the player with the updated functionality will appear. Note: You'll probably need to clear your cache and restart the browser for the changes to appear. &lt;p&gt;Again, all the files are available on CodePlex. There are even the beginnings of a &lt;a href=&quot;http://last.fm/&quot;&gt;last.fm&lt;/a&gt; station implementation up there as well. &lt;p&gt;&lt;strong&gt;Side Note&lt;/strong&gt; &lt;p&gt;Google’s Chrome browser has an implementation of the audio tag that plays a single audio file. I was unable to replace their player with the Gestalt version, since the Stop method on the player did not seem to work for me.  &lt;p&gt;To prevent audio files from playing simultaneously in their implementation and ours, I found it necessary to disable the Gestalt audio player in the Chrome browser. The shipping version of Chrome does not yet have an implementation of the video tag, so the Gestalt video player works just fine. &lt;p&gt;&lt;strong&gt;Developing with Gestalt&lt;/strong&gt; &lt;p&gt;Gestalt brings all the power of the Silverlight programming model to web developers, without requiring an integrated development environment. It's nice to have an IDE when possible, so for Mac users we've provided TextMate bundles with support for Gestalt and XAML off the &lt;a href=&quot;http://www.visitmix.com/labs/gestalt/downloads/&quot;&gt;Gestalt downloads&lt;/a&gt; page. For Windows, the Web Platform Installer can install Visual Studio Web Developer Edition, plus the Silverlight tools. (See the tools section of the installer to install VSWDE 2008 and the Silverlight tools. Get it from &lt;a href=&quot;http://www.silverlight.net/getstarted&quot;&gt;http://www.silverlight.net/getstarted&lt;/a&gt; . &lt;p&gt;If you create a custom implementation of the Gestalt media player, let us know—we'll link to it or place it in our Library. And if you find Gestalt useful on your site, shout it out and we will add a link. Let us know what you think by leaving a comment. If you &lt;a href=&quot;http://www.twitter.com/mixonline&quot;&gt;tweet&lt;/a&gt;, follow us on Twitter to learn about new content, opinions and articles. </description>
            <evnet:previewtext>It's true: Gestalt enables you to implement HTML5 video and audio tags. With just a little bit of JavaScript, Gestalt parses out media tags and injects all the HTML you need to embed a video or audio application. The Gestalt media player is also open source and customizable. Check it out at http://gestalt.codeplex.com. Cross-Platform Support Gestalt supports a media player that can play a list of media files in all browsers that support Silverlight—this means IE, Firefox, Chrome and Safari. Extend the Media Player Since we shipped the media player, I've added support for a button that shows/hides captions and</evnet:previewtext> 
            <link>http://visitmix.com/LabNotes/Using-the-HTML5-Video-and-Audio-Tag-with-Gestalt</link>
            <guid isPermaLink="true">http://visitmix.com/LabNotes/Using-the-HTML5-Video-and-Audio-Tag-with-Gestalt</guid>
            <pubDate>Thu, 03 Dec 2009 03:55:46 GMT</pubDate>
            <category>Development</category>
            <category>Silverlight</category>
            <category>Gestalt</category>
        </item>
        <item>
            <dc:creator>Karsten Januszewski</dc:creator>
            <title>JSON-P: An Elegant Hack (And Another Hack: Creating a JSON-P Service with the WCF REST Starter Kit!)</title>
            <description>&lt;p&gt;I'm working on some prototyping for an upcoming Mix Online prototype (a bit recursive, no?). My prototype provides a service with a REST interface, which has a few methods that send data via JSON and XML.&lt;/p&gt;  &lt;p&gt;I'm using the WCF REST Starter Kit (&lt;a href=&quot;http://www.asp.net/downloads/starter-kits/wcf-rest/%29&quot;&gt;http://www.asp.net/downloads/starter-kits/wcf-rest/)&lt;/a&gt; to get a REST service up and running quickly, and using the &lt;b&gt;UriTemplate&lt;/b&gt; syntax to make my REST service nice and Web 2.0-like.&amp;#160; It's working out wonderfully. Check out the Starter Kit and its excellent supporting documentation here: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ee391967.aspx&quot;&gt;http://msdn.microsoft.com/en-us/library/ee391967.aspx&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;The Cross Domain Scripting Problem&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;The service I'm prototyping will be consumed by other websites via javascript. At first, my architecture required the user to put a reference to my javascript in his or her page, to get around the cross domain scripting problem.&amp;#160; This is pretty standard operating procedure, but it isn't ideal—someone who wants to use my script has to load a third-party script from a different server, and take a dependency on me. &lt;/p&gt;  &lt;p&gt;In cases where the service provides more than data (say a mapping service like Virtual Earth), there's no way to get around requiring someone using the service to embed the script in their page. But in cases like mine, where the service is just providing data, it's best to allow the client to get at the data without referencing a script. But how?&amp;#160; Browsers don’t allow cross domain calls from javascript.&lt;/p&gt;  &lt;p&gt;As it turns out, there is a solution: JSON-P. The use of JSON-P allows my service to be called cross-domain without requiring an explicit embedding of a third party script. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;What's JSON-P?&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;JSON-P is a Javascript Object Notation with Padding.&amp;#160; What does that mean?&amp;#160; Pretty simple, really: When a provider returns its data formatted as JSON-P, the JSON is wrapped with a callback specified by the client. &lt;/p&gt;  &lt;p&gt; So, this JSON: &lt;/p&gt;  &lt;pre&gt;     { ‘name’: ‘Karsten’ }&lt;/pre&gt;

&lt;p&gt;becomes this JSON-P: &lt;/p&gt;

&lt;pre&gt;     myCallback( { ‘name’: ‘Karsten’ } ); &lt;/pre&gt;

&lt;p&gt;myCallback gets called by the client when it is passed to the service.&amp;#160; What's the point?&amp;#160; Well, instead of referencing the third party script at design-time, the client can call the service just as they would call an AJAX service from the existing domain. The result? The client can get at data from a service that is cross domain. &lt;/p&gt;

&lt;p&gt;Most javascript libraries support JSON-P, so you don't have to manually do anything—it &amp;quot;just works&amp;quot;. With jQuery, you don't even have to provide the callback; you can just add a question mark to the end of the service call, like so:&lt;/p&gt;

&lt;pre&gt;     callback=? &lt;/pre&gt;

&lt;p&gt;The callback gets auto-generated and you simply embed your logic in the call, like this: &lt;/p&gt;

&lt;pre&gt;&lt;p&gt;&amp;#160;&amp;#160; $.getJSON(&amp;quot;&lt;a href=&quot;http://example.com/service?callback=?&amp;quot;&quot;&gt;http://example.com/service?callback=?&amp;quot;&lt;/a&gt;,&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;       function(data) { 
&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; //do something with the data&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }); &lt;/p&gt;&lt;/pre&gt;

&lt;p&gt;&lt;b&gt;Safety Issues&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Some folks worry about security holes with JSON-P, but I wonder—is&lt;b&gt; &lt;/b&gt;the JSON-P solution really that much different than embedding a script from another URL in your page?&lt;/p&gt;

&lt;p&gt;I think not. In fact, you might argue that JSON-P is (marginally) more secure than embedding a third party script in your page, because usually JSON-P is just returning data. &lt;/p&gt;

&lt;p&gt;I say &lt;i&gt;marginally&lt;/i&gt; because there's nothing stopping the service that's returning the JSON-P from returning malicious code instead of data. So you'd better trust the service, just as you'd better trust any third party script that you embed in your page.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;An Elegant Hack?&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;JSON-P might just be a cross site scripting hack—but it's a very elegant hack that means my service can be called cross domain.&amp;#160; And it is becoming increasing popular. Services such as Twitter, YouTube, Digg and a host of other big name services out there offer their data up as JSON-P.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Supporting JSON-P&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;This all leads me to my prototype, in which I want to support JSON-P.&amp;#160; JSON-P isn't supported by default in WCF until .NET 4. But, it turns out there is a very nice sample which supports JSON-P in WCF. Download it here: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/cc716898.aspx&quot;&gt;http://msdn.microsoft.com/en-us/library/cc716898.aspx&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;&lt;b&gt;JSON-P and the REST Starter Kit&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;It turns out that you can use JSON-P in combination with the REST Starter Kit. Here's the signature of a method that combines &lt;b&gt;URITemplate&lt;/b&gt; features of the REST Starter Kit with the &lt;b&gt;JSONPBehavior&lt;/b&gt; attribute, provided by the WCF JSON-P sample: &lt;/p&gt;

&lt;pre&gt;&lt;p&gt;&amp;#160;&amp;#160;&amp;#160; [WebGet(ResponseFormat = WebMessageFormat.Json, &lt;br /&gt;            UriTemplate = &amp;quot;{userName}?cb={callbackName}&amp;quot;)]&amp;#160;&amp;#160; &lt;br /&gt;    [OperationContract]&lt;br /&gt;    [JSONPBehavior(callback = &amp;quot;callbackName&amp;quot;)]&lt;br /&gt;    public string GetDataJSONCallback(string userName, &lt;br /&gt;           string callbackName) 
&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; { 
&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return userName + “: I was called by WCF!”; 
&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/p&gt;&lt;/pre&gt;

&lt;p&gt;What’s going on here?&amp;#160; Well, the first attribute, &lt;b&gt;WebGet&lt;/b&gt;, specifies that we want to 1) return JSON and 2) that our &lt;b&gt;URITemplate&lt;/b&gt; has a path which includes the name of the callback. (Note: Don’t be distracted by the userName parameter; I included that to show how the REST path syntax works.) &lt;/p&gt;

&lt;p&gt;The crux is that the variable name of the callback name, in this case &lt;b&gt;callbackName&lt;/b&gt;, needs to match between the &lt;b&gt;WebGet&lt;/b&gt; attribute, the &lt;b&gt;JSONPBehavior&lt;/b&gt; attribute and the signature of the method call itself.&amp;#160; If this is the case and all three are the same, magic happens: the service will return its data wrapped in JSONP with the name of the callback specified by the client.&amp;#160; Thanks, WCF!&lt;/p&gt;

&lt;p&gt;&lt;b&gt;The Trade-off&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;When you use the &lt;b&gt;JSONPBehavior&lt;/b&gt; attribute, you intercept the request and override the WCF &lt;b&gt;MessageEncoder&lt;/b&gt;. This means you bypass some of the glue in the REST Starter Kit, so things like caching will no longer work. This is the only &amp;quot;gotcha&amp;quot; with combining the REST Starter Kit and the &lt;b&gt;JSONPBehavior&lt;/b&gt; attribute. But for me, the tradeoff is worth it.&lt;/p&gt;

&lt;p&gt;To make life more encapsulated, I went ahead and took the four classes from the JSON-P sample (JSONPBehavior.cs, JSONPBindingElement.cs, JSONPBindingExtension.cs and JSONPEncoderFactory.cs) and compiled them into a single .dll which I then referenced in my WCF Service.&amp;#160; Hat's off to whoever wrote such a well-encapsulated sample.&amp;#160; &lt;/p&gt;</description>
            <evnet:previewtext>I'm working on some prototyping for an upcoming Mix Online prototype (a bit recursive, no?). My prototype provides a service with a REST interface, which has a few methods that send data via JSON and XML.  I'm using the WCF REST Starter Kit (http://www.asp.net/downloads/starter-kits/wcf-rest/) to get a REST service up and running quickly, and using the UriTemplate syntax to make my REST service nice and Web 2.0-like.&amp;#160; It's working out wonderfully. Check out the Starter Kit and its excellent supporting documentation here: http://msdn.microsoft.com/en-us/library/ee391967.aspx.  The Cross Domain Scripting Problem  The service I'm prototyping will be consumed by other</evnet:previewtext> 
            <link>http://visitmix.com/LabNotes/JSON-P-An-Elegant-Hack</link>
            <guid isPermaLink="true">http://visitmix.com/LabNotes/JSON-P-An-Elegant-Hack</guid>
            <pubDate>Mon, 16 Nov 2009 21:30:28 GMT</pubDate>
            <category>Development</category>
            <category>jQuery</category>
        </item>
        <item>
            <dc:creator>Hans Hugli</dc:creator>
            <title>Getting Familiar with MVC</title>
            <description>&lt;p&gt;&lt;strong&gt;The Redesign&lt;/strong&gt; &lt;/p&gt;  &lt;p&gt;Guess what? We’re in the early stages of a Mix Online redesign and I’m on point to develop the new site. &lt;/p&gt;  &lt;p&gt;Members of my team, always helpful, have told me to take a look at the new &lt;a href=&quot;http://oxite.codeplex.com/&quot;&gt;Oxite&lt;/a&gt; MVC (Model/View/Controller) implementation. Oxite is a layer built on top of ASP.NET MVC that you can use for blog engines, websites, etc.—it even has Content Manage Services (CMS) built in.&lt;/p&gt;  &lt;p&gt;I’ve had a limited exposure to the MVC pattern, so I did some research into the benefits of using a MVC architecture over a typical ASP.NET WinForm architecture. Here are some advantages that MVC promises.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Classic ASP.NET-like. Clean semantics in the .aspx files. &lt;/li&gt;    &lt;li&gt;Tight control over markup output. &lt;/li&gt;    &lt;li&gt;URLs are friendlier for users and Search Engine Optimization with “routing.” For example a URL such as “Wikipedia.org/wiki/model view controller” maps to an actual page that contains information on the “Model View Controller” architecture. This is *much* more meaningful than “www.somesite.com/default.aspx?contentid=1234.” &lt;/li&gt;    &lt;li&gt;Frictionless testability - Each component has one responsibility which means they aren't used in multiple places in the application. This makes testing easier. &lt;/li&gt;    &lt;li&gt;Improves code maintenance. MVC employs the &lt;a href=&quot;http://en.wikipedia.org/wiki/Don't_repeat_yourself&quot;&gt;DRY&lt;/a&gt;&amp;#160; or “Don’t repeat yourself” principle, so that changes in elements do not affect the rest of the site. &lt;/li&gt;    &lt;li&gt;Aids in concurrent development. The MVC framework separates the concerns of the Developer (in the Model and Controller) and Designer (in the View.) &lt;/li&gt;    &lt;li&gt;MVC leverages Membership/Profile/Caching/Localization and the other services of ASP.NET that have made it so great. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;No WinForms!&lt;/strong&gt; &lt;/p&gt;  &lt;p&gt;ASP.NET MVC does not employ ASP.NET WinForms, which can be limiting because they make final markup output difficult to control. Instead, MVC gives that total control back to the developer. It's also completely extensible, since the majority of the classes made available to the developer are not sealed, and are therefore inheritable. &lt;/p&gt;  &lt;p&gt;With this complete control comes the responsibility to do some things “manually.” That said, I think most developers would rather work with a flexible and unimpaired model than be restricted when they need that special something that ASP.NET WinForms is simply not designed for.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Classic ASP?&lt;/strong&gt; &lt;/p&gt;  &lt;p&gt;As mentioned, MVC employs .aspx pages that use a classic ASP syntax. Although classic ASP can make it tricky to do more complex HTTP POSTS, for the most part it solves a lot of a website's basic problems.&lt;/p&gt;  &lt;p&gt;As an added bonus, ASP.NET MVC also has features that help solve tougher problems like integrating client side scripts in an elegant way.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Learn More&lt;/strong&gt; &lt;/p&gt;  &lt;p&gt;The Model/View/Controller architecture has been around since 1979, so there’s a lot of information to sift through on the topic. If you're curious: &lt;/p&gt;  &lt;p&gt;The Wikipedia description of &lt;a href=&quot;http://en.wikipedia.org/wiki/Model_view_controller&quot;&gt;MVC&lt;/a&gt; info is a good place to start, but there's also a lot of ASP.NET MVC-specific info out there: Scott Guthrie's announcement &lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2009/04/01/asp-net-mvc-1-0.aspx&quot;&gt;post&lt;/a&gt; gives a great overview; this &lt;a href=&quot;http://videos.visitmix.com/MIX09/T50F&quot;&gt;video&lt;/a&gt; by Phil Haack is a nice demonstration of the ASP.NET MVC Framework; Brad Abrams' &lt;a href=&quot;http://blogs.msdn.com/brada/archive/2008/01/29/asp-net-mvc-example-application-over-northwind-with-the-entity-framework.aspx&quot;&gt;post&lt;/a&gt; is an example of MVC applied the Northwind database, also using the Entity Framework.&lt;/p&gt;  &lt;p&gt;&lt;i&gt;Have you found nirvana using MVC, or not? Have you found that there are applications that are better suited, or not well suited for MVC? I’m curious and would love to hear.&lt;/i&gt; &lt;i&gt;Let us know by leaving a comment. And if you tweet, &lt;a href=&quot;http://www.twitter.com/mixonline&quot;&gt;follow&lt;/a&gt; us on Twitter to learn about new content, opinions and articles.&lt;/i&gt;&lt;/p&gt;</description>
            <evnet:previewtext>The Redesign   Guess what? We’re in the early stages of a Mix Online redesign and I’m on point to develop the new site.   Members of my team, always helpful, have told me to take a look at the new Oxite MVC (Model/View/Controller) implementation. Oxite is a layer built on top of ASP.NET MVC that you can use for blog engines, websites, etc.—it even has Content Manage Services (CMS) built in.  I’ve had a limited exposure to the MVC pattern, so I did some research into the benefits of using a MVC architecture over a typical</evnet:previewtext> 
            <link>http://visitmix.com/LabNotes/Getting-Familiar-with-MVC</link>
            <guid isPermaLink="true">http://visitmix.com/LabNotes/Getting-Familiar-with-MVC</guid>
            <pubDate>Wed, 21 Oct 2009 23:37:00 GMT</pubDate>
            <category>Development</category>
            <category>ASP.NET MVC</category>
            <category>Oxite</category>
        </item>
        <item>
            <dc:creator>Karsten Januszewski</dc:creator>
            <title>jQuery Love: Microsoft’s CDN Service for Microsoft AJAX Library and jQuery</title>
            <description>&lt;p&gt;&lt;b&gt;jQuery Love: Microsoft’s CDN Service for Microsoft AJAX Library and jQuery&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;A few weeks back, Microsoft announced a new content delivery network (CDN) that supports hosting for both the Microsoft AJAX libraries and the &lt;a href=&quot;http://jquery.com/&quot;&gt;jQuery&lt;/a&gt; library. This is an exciting development and big step toward improving the performance of AJAX applications: by referencing the libraries hosted on the CDN, you can rest assured that users hitting your website will be served a copy of the library from a server local to their location.&lt;/p&gt;  &lt;p&gt;The move also highlights Microsoft's commitment to supporting the jQuery library.&amp;#160; Not only does the CDN host jQuery 1.3.2, it also hosts the jQuery VSDOC file, which provides intellisense for jQuery from within Visual Studio. (For more on using jQuery with Visual Studio, see &lt;a href=&quot;http://blogs.msdn.com/webdevtools/archive/2008/11/18/jscript-intellisense-faq.aspx&quot;&gt;http://blogs.msdn.com/webdevtools/archive/2008/11/18/jscript-intellisense-faq.aspx&lt;/a&gt;.) In addition, the CDN hosts the popular plug-in &lt;a href=&quot;http://bassistance.de/jquery-plugins/jquery-plugin-validation/&quot;&gt;jQuery.Validate&lt;/a&gt;, which makes adding client-side validation to forms very easy.&lt;/p&gt;  &lt;p&gt;If it isn’t clear yet, Microsoft—and we at Mix Online —are big fans of jQuery.&amp;#160; In fact, we’ll be updating Mix Online itself to use the jQuery from Microsoft’s CDN shortly.&amp;#160; And the next versions of &lt;a href=&quot;http://visitmix.com/lab/oomph&quot;&gt;Oomph&lt;/a&gt; and &lt;a href=&quot;http://visitmix.com/lab/glimmer&quot;&gt;Glimmer&lt;/a&gt; will use the CDN, as will a jQuery-dependent project I’m currently working on (top secret!).&lt;/p&gt;  &lt;p&gt;For more about Mix Online’s support for jQuery, check out &lt;a href=&quot;http://visitmix.com/lab/glimmer&quot;&gt;Glimmer&lt;/a&gt; (an interactive designer for jQuery). And for more general info, check out Yehuda Katz's article on &lt;a href=&quot;http://visitmix.com/Articles/The-Rise-Of-jQuery&quot;&gt;The Rise of jQuery&lt;/a&gt; and Dave Ward's piece on &lt;a href=&quot;http://visitmix.com/Opinions/What-ASPNET-Developers-Should-Know-About-jQuery&quot;&gt;ASP.NET Developers and jQuery&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;You can read more about the new CDN &lt;a href=&quot;http://www.asp.net/ajax/CDN/&quot;&gt;here&lt;/a&gt;. Below you'll find the short version—with all the URLs you need to know:&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Microsoft Ajax Releases on the CDN:&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Microsoft Ajax version 0909 (preview)&lt;/p&gt;  &lt;p&gt;http://ajax.microsoft.com/ajax/beta/0909/MicrosoftAjax.js&lt;/p&gt;  &lt;p&gt;http://ajax.microsoft.com/ajax/beta/0909/MicrosoftAjax.debug.js&lt;/p&gt;  &lt;p&gt;http://ajax.microsoft.com/ajax/beta/0909/MicrosoftAjaxAdoNet.js&lt;/p&gt;  &lt;p&gt;http://ajax.microsoft.com/ajax/beta/0909/MicrosoftAjaxAdoNet.debug.js&lt;/p&gt;  &lt;p&gt;http://ajax.microsoft.com/ajax/beta/0909/MicrosoftAjaxDataContext.js&lt;/p&gt;  &lt;p&gt;http://ajax.microsoft.com/ajax/beta/0909/MicrosoftAjaxDataContext.debug.js&lt;/p&gt;  &lt;p&gt;http://ajax.microsoft.com/ajax/beta/0909/MicrosoftAjaxTemplates.js&lt;/p&gt;  &lt;p&gt;http://ajax.microsoft.com/ajax/beta/0909/MicrosoftAjaxTemplates.debug.js&lt;/p&gt;  &lt;p&gt;http://ajax.microsoft.com/ajax/beta/0909/MicrosoftAjaxWebForms.js&lt;/p&gt;  &lt;p&gt;http://ajax.microsoft.com/ajax/beta/0909/MicrosoftAjaxWebForms.debug.js&lt;/p&gt;  &lt;p&gt;&lt;b&gt;jQuery Releases on the CDN:&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;jQuery version 1.3.2&lt;/p&gt;  &lt;p&gt;http://ajax.microsoft.com/ajax/jQuery/jquery-1.3.2.js&lt;/p&gt;  &lt;p&gt;http://ajax.microsoft.com/ajax/jQuery/jquery-1.3.2.min.js&lt;/p&gt;  &lt;p&gt;http://ajax.microsoft.com/ajax/jQuery/jquery-1.3.2-vsdoc.js&lt;/p&gt;  &lt;p&gt;http://ajax.microsoft.com/ajax/jQuery/jquery-1.3.2.min-vsdoc.js&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;jQuery Validation Releases on the CDN:&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;jQuery Validate 1.5.5&lt;/p&gt;  &lt;p&gt;http://ajax.microsoft.com/ajax/jquery.validate/1.5.5/jquery.validate.js&lt;/p&gt;  &lt;p&gt;http://ajax.microsoft.com/ajax/jquery.validate/1.5.5/jquery.validate.min.js&lt;/p&gt;  &lt;p&gt;http://ajax.microsoft.com/ajax/jquery.validate/1.5.5/jquery.validate-vsdoc.js&lt;/p&gt;</description>
            <evnet:previewtext>jQuery Love: Microsoft’s CDN Service for Microsoft AJAX Library and jQuery  A few weeks back, Microsoft announced a new content delivery network (CDN) that supports hosting for both the Microsoft AJAX libraries and the jQuery library. This is an exciting development and big step toward improving the performance of AJAX applications: by referencing the libraries hosted on the CDN, you can rest assured that users hitting your website will be served a copy of the library from a server local to their location.  The move also highlights Microsoft's commitment to supporting the jQuery library.&amp;#160; Not only does the</evnet:previewtext> 
            <link>http://visitmix.com/LabNotes/jquery-love</link>
            <guid isPermaLink="true">http://visitmix.com/LabNotes/jquery-love</guid>
            <pubDate>Fri, 02 Oct 2009 20:59:57 GMT</pubDate>
            <category>Development</category>
            <category>Oomph</category>
            <category>Glimmer</category>
            <category>jQuery</category>
        </item>
        <item>
            <dc:creator>Hans Hugli</dc:creator>
            <title>DLR and JavaScript Interoperability with Gestalt</title>
            <description>&lt;p&gt;&lt;b&gt;&lt;i&gt;How can I mix the results of a Python script to do or execute a javascript function with Gestalt?&lt;/i&gt;&lt;/b&gt;  &lt;p&gt;When one of our smart readers asked the question above, we knew we had a challenge on our hands. We accepted the challenge, took a look at the problem--and came up with two samples that show 1) calling a JavaScript function from Python or Ruby and 2) calling a Python or Ruby method from JavaScript. In this article I'll cover Python; the Ruby version is linked below.  &lt;p&gt;&lt;b&gt;Python, Calling JavaScript.&lt;/b&gt;  &lt;p&gt;In the context of a Silverlight application, Python runs in an entirely different process than JavaScript. Still, Python can easily call a JavaScript function by using the HtmlPage class in the System.Windows.Browser namespace. Let's say, for example, that we have a JavaScript function named &quot;javascriptFunction,&quot; like this: &lt;pre&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt; 
   function javascriptFunction(x) {
      alert(x);
   }
&amp;lt;/script&amp;gt;&lt;/pre&gt;
&lt;p&gt;Here, we’ve imported the HtmlPage class into the Python script. This class contains an Invoke method which accepts a string: the name of the JavaScript function we want to call, plus a parameter list. In this snippet we happen to pass a string as our parameter, but we could just as easily pass an object: &lt;pre&gt;&amp;lt;script language=&quot;python&quot; type=&quot;text/python&quot;&amp;gt; 
from System.Windows.Browser import HtmlPage 
HtmlPage.Window.Invoke(&quot;javascriptFunction&quot;, &quot;Hello I'm 
   Python!&quot;); 
&amp;lt;/script&amp;gt;&lt;/pre&gt;
&lt;p&gt;What action results from these two fragments of code? As soon as the Python script executes, it makes a call to the JavaScript method and pops an alert box with the parameter that was passed. Very straightforward. 
&lt;p&gt;&lt;b&gt;JavaScript, Calling Python.&lt;/b&gt; 
&lt;p&gt;Calling Python from JavaScript is a little trickier than the other way around, since Python is running in a different process. One solution is to register a JavaScript click event in the Python script so that when an HTML button click fires an event, it is caught in Python. This works--but is limited--since we want JavaScript to call a function that raises an event in Python. As a workaround we might try raising the button click event, but this doesn't successfully trigger the Python-registered event. Back to square one. 
&lt;p&gt;The best solution here is to expose the JavaScript function &quot;registerDlrFn&quot; that takes an object as a parameter. In this case, the object we're expecting is an EventHandler, which is assigned to a local variable &quot;DlrFn&quot;. Once the variable is assigned, we can simply fire the event by calling it. We wrap the call to fire the event in the function &quot;callDlrFn&quot;: &lt;pre&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt; 
   function registerDlrFn(fn) { 
      DlrFn = fn; 
   } 
   function callDlrFn(x) { 
      DlrFn(x, null); 
   } 
   callDlrFn (&quot;Hello this is javascript&quot;); 
&amp;lt;/script&amp;gt;&lt;/pre&gt;
&lt;p&gt;We’re not quite done yet, though. For Python to &lt;i&gt;catch&lt;/i&gt; the call to the &quot;registerDlrFn&quot; function, we need to use the HtmlPage.Invoke method again. This time we pass an event handler that's cast to HtmlEventArgs, which is bound to &quot;PythonMethod,&quot; the method we want to call from JavaScript. Note that when the Python script is executed, the &quot;registerDlrFn&quot; function is invoked immediately. The EventHandler is passed and assigned to &quot;DlrFn&quot; in the JavaScript. Thus, the HTML DOM becomes aware of the EventHandler, making it callable from JavaScript: &lt;pre&gt;&amp;lt;script language=&quot;python&quot; type=&quot;text/python&quot;&amp;gt; 
from System.Windows.Browser import HtmlPage 
def PythonMethod(s,e): 
   window.Alert(s) 
HtmlPage.Window.Invoke(&quot;registerDlrFn&quot;, 
   EventHandler[HtmlEventArgs](PythonMethod)) 
&amp;lt;/script&amp;gt;&lt;/pre&gt;
&lt;p&gt;&lt;b&gt;The Lesson?&lt;/b&gt;
&lt;p&gt;As you can see, calling Python from JavaScript was less intuitive than the other way around. This same approach applies to Ruby and JavaScript interoperability. You can find a Python sample &lt;a href=&quot;http://www.visitmix.com/labs/gestalt/samples/interop/javascript_Python_Interop.html&quot;&gt;here&lt;/a&gt;, or a Ruby sample &lt;a href=&quot;http://www.visitmix.com/labs/gestalt/samples/interop/javascript_Ruby_Interop.html&quot;&gt;here.&lt;/a&gt; Remember to right-click if you want to view the source code for the samples! 
&lt;p&gt;&lt;i&gt;We appreciate and look forward to your feedback. Please don’t hesitate to leave a comment, and if you twitter, &lt;a href=&quot;http://www.twitter.com/mixonline&quot;&gt;follow&lt;/a&gt; us there to hear when we release new content, opinions or articles.&lt;/i&gt;</description>
            <evnet:previewtext>How can I mix the results of a Python script to do or execute a javascript function with Gestalt?  When one of our smart readers asked the question above, we knew we had a challenge on our hands. We accepted the challenge, took a look at the problem--and came up with two samples that show 1) calling a JavaScript function from Python or Ruby and 2) calling a Python or Ruby method from JavaScript. In this article I'll cover Python; the Ruby version is linked below.  Python, Calling JavaScript.  In the context of a Silverlight application, Python</evnet:previewtext> 
            <link>http://visitmix.com/LabNotes/DLR-and-JavaScript-Interoperability-with-Gestalt</link>
            <guid isPermaLink="true">http://visitmix.com/LabNotes/DLR-and-JavaScript-Interoperability-with-Gestalt</guid>
            <pubDate>Thu, 27 Aug 2009 16:03:46 GMT</pubDate>
            <category>Development</category>
            <category>Ruby</category>
            <category>Gestalt</category>
            <category>Python</category>
        </item>
        <item>
            <dc:creator>Hans Hugli</dc:creator>
            <title>Writing a UserControl in Python</title>
            <description>&lt;p&gt;While putting together samples for Gestalt, I found that I could save a vast amount of time creating a control’s UI using XAML (XML Application Markup Language) as opposed to spending time to generate it programmatically. It’s not only time consuming creating it in verbose code, but it forces you to spend time getting to understand the nuances of XAML-to-code translation.  &lt;p&gt;Incidentally, in case you are not familiar with &lt;a href=&quot;http://www.visitmix.com//labs/gestalt&quot; target=&quot;_blank&quot;&gt;Gestalt&lt;/a&gt;, it is a javascript that you can add to your web pages, which enables web developers to write rich web applications without the need of an Integrated Development Environment. Now you can write RIA applications using only XAML, and Python or Ruby! Behind the scenes Gestalt uses Silverlight to generate the UI.  &lt;p&gt;I’m going to examine the code for the &lt;a href=&quot;http://www.visitmix.com/labs/gestalt/samples/trigonometry/trigonometry.advanced.python.html&quot;&gt;Advanced Trigonometry&lt;/a&gt; sample to see how we employed UserControls to create “Node” objects.  &lt;p&gt;A fairly elegant approach to accomplishing this task is to create a typical XAML file and load it using the .Net XamlParser class. We download the XAML file using the .Net WebClient class, which returns it as a string. In the sample’s initialization we begin the process of creating our “Node” UserControl by first calling: &lt;pre&gt;client = WebClient() 
client.DownloadStringCompleted += NodeLoaded 
client.DownloadStringAsync(Uri(&quot;node.xaml&quot;, 
     UriKind.Relative)) 
&lt;/pre&gt;
&lt;p&gt;When the XAML has been downloaded as a string, the NodeLoaded event fires. In the NodeLoaded method the string is cached in the _node variable. &lt;pre&gt;def NodeLoaded(sender, e): 
   global _node 
   _node = e.Result 
&lt;/pre&gt;
&lt;p&gt;Before I move on, we need to take a look at the Node class which inherits from UserControl (inside the parens means inheritance in Python) and takes a string, xaml, as a parameter. The CreateObject method calls the XamlReader.Load method. This method accepts a string and generates an object graph. The Content assignment makes the call to the CreateObject method and assigns the generated object graph to the UserControl’s inherent Content property. &lt;pre&gt;class Node(UserControl): 
   def __init__(self, xaml): 
      self.xaml = xaml 
   def CreateObject(value): 
      return XamlReader.Load(value) 
   self.Content = CreateObject(self.xaml) 
&lt;/pre&gt;
&lt;p&gt;Now the UserControl can be created. The Main() method calls: &lt;pre&gt;n = Node(_node)&lt;/pre&gt;
&lt;p&gt;which passes in the Node.xaml contents as a string, and in turn creates a Node instance. To access any of the XAML elements in the XAML they need to be accessed via the Content property, like so: &lt;pre&gt;n.Content.MyXamlElement.MyXamlElementProperty = somevalue&lt;/pre&gt;
&lt;p&gt;Another very useful thing to know is how the create Python properties in classes, there are many approaches. This is the basic approach I took in the Python 2.6 implementation that the DLR uses. In the class definition you must create two methods and refer to them in a call to the property method. If added to the above Node class, the following fragment would update the node’s Left position when the X property of the node is set, and return its Left position when retrieved. &lt;pre&gt;   ### X property ### 
   def SetX(self, value): 
      self.SetValue(Canvas.LeftProperty, 
         Convert.ToDouble(value)) 
   def GetX(self): 
      return self.GetValue(Canvas.LeftProperty) 
   X = property(GetX, SetX)
&lt;/pre&gt;
&lt;p&gt;Finally, assign the Text property of one of the Node’s XAML elements, and add the created node to a “nodes” Canvas, specified in the main application xaml, like so: &lt;pre&gt;n.Content.display.Text = &quot;I am a node&quot;
nodes.Children.Add(n)&lt;/pre&gt;
&lt;p&gt;Knowing how to create a UserControl in Python with Gestalt, greatly increases productivity, and you can start putting together some very robust applications now. You should know that these UserControls cannot be directly referenced in any XAML since the XAML would need to contain assembly references to your custom UserControls. Today there is no built in support for this scenario, but to work around this, simply add UserControls to XAML elements programmatically. 
&lt;p&gt;Note that this sample depends on being served off a web server since it is utilizing the WebClient and so will not work on the local machine alone. The source to this entire sample (including the XAML files) is available &lt;a href=&quot;http://www.visitmix.com/labs/gestalt/samples/trigonometry/trigonometry.zip&quot;&gt;here&lt;/a&gt;. 
&lt;p&gt;&lt;em&gt;If you have a comment, or if you have an even cleaner approach that eliminates the need for accessing XAML elements via the Content property, please do&amp;nbsp; not hesitate to leave a comment Leave a comment, and if twitter is your thing, &lt;a href=&quot;http://www.twitter.com/mixonline&quot;&gt;follow&lt;/a&gt; us.&lt;/em&gt;&lt;/p&gt;</description>
            <evnet:previewtext>While putting together samples for Gestalt, I found that I could save a vast amount of time creating a control’s UI using XAML (XML Application Markup Language) as opposed to spending time to generate it programmatically. It’s not only time consuming creating it in verbose code, but it forces you to spend time getting to understand the nuances of XAML-to-code translation.  Incidentally, in case you are not familiar with Gestalt, it is a javascript that you can add to your web pages, which enables web developers to write rich web applications without the need of an Integrated Development Environment.</evnet:previewtext> 
            <link>http://visitmix.com/LabNotes/Writing-a-UserControl-in-Python</link>
            <guid isPermaLink="true">http://visitmix.com/LabNotes/Writing-a-UserControl-in-Python</guid>
            <pubDate>Fri, 31 Jul 2009 22:46:35 GMT</pubDate>
            <category>Development</category>
            <category>Gestalt</category>
            <category>Python</category>
        </item>
        <item>
            <dc:creator>Hans Hugli</dc:creator>
            <title>TreeMaps</title>
            <description>&lt;p&gt;In working on &lt;a href=&quot;http://www.visitmix.com/Lab/descry&quot;&gt;Descry&lt;/a&gt; we wanted to have one of the samples show a TreeMap infographic that displayed some data in an interesting way. Since the elections were occurring right at the time of the Descry launch, &lt;a href=&quot;http://www.visitmix.com/About/nishkoth&quot;&gt;Nishant&lt;/a&gt; suggested that we show inaugural data in our &lt;a href=&quot;http://www.visitmix.com/labs/descry/theirfirstwords/&quot;&gt;TreeMap&lt;/a&gt;. This TreeMap shows the incidence of occurrence of particular words or phrases grouped in the TreeMap visualization. &lt;/p&gt;  &lt;p&gt;When we originally wrote the TreeMap code, I had ported the TreeMap control from a Windows Presentation Foundation sample in the &lt;a href=&quot;http://j832.com/bagotricks/&quot;&gt;WPF Bag o’ tricks&lt;/a&gt; that was a single tiered implementation of a Squarified TreeMap. What is a Squarified TreeMap? Historically TreeMaps tended to sort items ascending by their children’s weights; i.e. items are listed in decreasing order of size, but this leads to the problem of children becoming increasingly thin vertically or horizontally as ever more children are added to a TreeMap, and makes it difficult to get a sense of relative size and also is not very esthetically pleasing. This &lt;a href=&quot;http://www.codeproject.com/KB/recipes/treemaps.aspx&quot;&gt;article&lt;/a&gt; written by Jonathan Hodgson explains the problem very clearly and graphically, and it also points to the original &lt;a href=&quot;http://www.win.tue.nl/~vanwijk/stm.pdf&quot;&gt;research&lt;/a&gt; that was done to dramatically improve the effectiveness of the TreeMap to communicate information. I found it to be very interesting, and I wanted to be sure to pass it along. &lt;/p&gt;  &lt;p&gt;Though our inaugural sample shows data in a single tier, the TreeMap implementation supports the nesting &lt;i&gt;n&lt;/i&gt;-tiers of data; i.e. where TreeMaps contain other TreeMaps, this enables display of tiered or nested data such as a hard drive directory or any kind of data that has a hierarchal tree signature. &lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://timheuer.com/blog/&quot;&gt;Tim Heuer&lt;/a&gt; just recently pointed out some very timely financial information that is well suited for a TreeMap control. He was referring to Department of the Treasury funded &lt;a href=&quot;http://financialstability.gov/impact/index.html&quot;&gt;transactions&lt;/a&gt; of the Capital Purchase Program (CPP). The government site shows a U.S. map that displays the sum total of transactions per state on a mouse over and a list of the transactions per state when you click on a particular state. &lt;/p&gt;  &lt;p&gt;I need to step back a moment and say that the purpose of a visualization is to answer a question. In the CPP case the question that the author most likely ask was: What is the sum of transactions for a given state? The map infographic answers that question well, but suppose we wanted to ask: Which state is getting most of the money? The map infographic does not answer this well since you would need to literally mouse over every single state to find the largest dollar amount. &lt;/p&gt;  &lt;p&gt;One of the ways to answer our new question is to use a TreeMap control since it can give a sense of how large the transactions are for a given state relative to one another. To make this possible the data needs to be grouped by state, and then by institution. The above government site provided a link to the &lt;a href=&quot;http://financialstability.gov/impact/SellerList.xml&quot;&gt;XML&lt;/a&gt; source that was used to generate their graphic, so I thought I’d try to quickly put this data into a TreeMap infographic. &lt;/p&gt;  &lt;p&gt;I find that getting data into a format that a particular type of visualization such as a TreeMap can consume, is typically the most time consuming part of creating a visualization or infographic. There are two routes, in my mind. Write the visualization control in a smart and generic way so that it can consume many types of data sources, or alternately write it so that it will only accept one type of data source (such as a specific XML format) and put the burden of munging that data into that specific format, on the user. Which one is more useful depends on what arena you come from; for a developer doing XML transforms is not too uncommon, but for someone less technical, a generic control would&amp;#160; be more useful. It seems with flexibility comes complexity. &lt;/p&gt;  &lt;p&gt;For this case I did the later; I reformatted the XML to allow the TreeMap control to consume the CPP data. The infographic is posted, click on the image to see it.&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://www.visitmix.com/labs/descry/cpptreemapsample/&quot;&gt;&lt;img border=&quot;0&quot; alt=&quot;A TreeMap Sample&quot; src=&quot;/content/files/TwoTieredTreeMap.jpg&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://www.visitmix.com/labs/descry/cpptreemapsample/&quot;&gt;View&lt;/a&gt; the sample, and download the source for this sample &lt;a href=&quot;http://descry.codeplex.com/SourceControl/ListDownloadableCommits.aspx&quot;&gt;here&lt;/a&gt; available via the Descry project on &lt;a href=&quot;http://www.codeplex.com/descry&quot;&gt;CodePlex&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;What are your thoughts about creating reusable infographics? What have you found to be effective? Let us know in a &lt;a href=&quot;http://visitmix.com/Opinions/TreeMaps&quot;&gt;comment&lt;/a&gt; or you can always contact &lt;a href=&quot;http://www.twitter.com/hanshu&quot;&gt;me&lt;/a&gt;, or &lt;a href=&quot;http://twitter.com/mixonline&quot;&gt;Subscribe&lt;/a&gt; to our twitter feed if you'd like to stay in touch with us. &lt;/em&gt;&lt;/p&gt;</description>
            <evnet:previewtext>In working on Descry we wanted to have one of the samples show a TreeMap infographic that displayed some data in an interesting way. Since the elections were occurring right at the time of the Descry launch, Nishant suggested that we show inaugural data in our TreeMap. This TreeMap shows the incidence of occurrence of particular words or phrases grouped in the TreeMap visualization.   When we originally wrote the TreeMap code, I had ported the TreeMap control from a Windows Presentation Foundation sample in the WPF Bag o’ tricks that was a single tiered implementation of a Squarified</evnet:previewtext> 
            <link>http://visitmix.com/LabNotes/TreeMaps</link>
            <guid isPermaLink="true">http://visitmix.com/LabNotes/TreeMaps</guid>
            <pubDate>Thu, 09 Apr 2009 20:29:18 GMT</pubDate>
            <category>Development</category>
            <category>Descry</category>
            <category>Infographics</category>
        </item>
    </channel>
</rss>