<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><!--Generated by Squarespace Site Server v5.8.0 (http://www.squarespace.com/) on Sat, 07 Nov 2009 21:15:38 GMT--><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><title>David Yack's Blog!</title><link>http://blog.davidyack.com/journal/</link><description /><lastBuildDate>Sun, 11 Oct 2009 21:18:59 +0000</lastBuildDate><copyright /><language>en-US</language><generator>Squarespace Site Server v5.8.0 (http://www.squarespace.com/)</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/DavidYack" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item><title>Cloud Computing Meets the Tax Man</title><dc:creator>David Yack</dc:creator><pubDate>Sun, 11 Oct 2009 21:18:58 +0000</pubDate><link>http://blog.davidyack.com/journal/2009/10/11/cloud-computing-meets-the-tax-man.html</link><guid isPermaLink="false">154714:1437668:5464185</guid><description><![CDATA[<p>Friday I got a nice surprise e-mail from the Azure team - “Action Required : Migrating Applications from the “USA – Northwest” – it continued to let me know that the northwest region will no longer be supported.&#160; It suggested that I delete my project and re-create it using the south west region.&#160; Ideally I would prefer they just handle it, but since Azure is still in CTP mode I will cut them a little slack.&#160; </p>  <p>Looking into this a little more I found some more clear details on the Azure team blog <a href="http://blogs.msdn.com/windowsazure/archive/2009/08/04/migrating-from-usa-northwest.aspx">here</a>.&#160; It explains “Due to a change in local tax laws, we’ve decided to migrate Windows Azure applications out of our northwest data center“&#160;&#160; </p>  <p>You might notice the blog post is dated August – not sure if I saw that and thought it didn’t apply or never read it.&#160; Either way, from my perspective most the time I don’t care if my data is in the South / North, East, West&#160; - I do tend to care which country it’s in but besides that I just want it to be handled behind the scenes.&#160; There are however good reasons to allow some control over the specific location when the application and / or business needs dictate.&#160; It would be great to see Azure provide some tools to allow you to migrate data as needed between the regions. </p>  <p>As more applications move to have data hosted in the cloud we can only expect more skirmishes to occur with the taxing authorities as they wrestle to figure out a balance between getting their fair share of taxes and pushing businesses away.&#160; This article on the Data Center Knowledge site elaborates a little more on the specifics of the Microsoft problem with <a href="http://www.datacenterknowledge.com/archives/2009/08/05/microsoft-migrates-azure-citing-tax-laws/">Azure</a> here.&#160;&#160; I suspect we also haven’t seen the end of location matters for other legal jurisdictions of data as well but that’s a topic for another day.</p>  <p>Part of the appeal of cloud computing is it’s ability to abstract you from some of the low level issues of hosting data and computing power.&#160; Power, cooling, hardware expenses, taxes and more are all of the package that makes this type of arrangement interesting.&#160; It stands to reason that companies like Microsoft will make location decisions to where there is a strategic advantage for a key component of their expenses in providing the service.&#160; In fact,&#160; I think that will be required for any of these companies to be competitive.&#160; I also think that making that as non impactful to the end user is also a core requirement of offering the service as well.</p>]]></description><wfw:commentRss>http://blog.davidyack.com/journal/rss-comments-entry-5464185.xml</wfw:commentRss></item><item><title>Lessons learned from my iPhone experiment</title><dc:creator>David Yack</dc:creator><pubDate>Wed, 23 Sep 2009 07:25:22 +0000</pubDate><link>http://blog.davidyack.com/journal/2009/9/23/lessons-learned-from-my-iphone-experiment.html</link><guid isPermaLink="false">154714:1437668:5273520</guid><description><![CDATA[<p>About once a year I need a new phone. Not because the old one dies, but I get bored and start looking for something new.&#160; This year was no different as I approached my one year of replacing my Treo 750 with a Treo Pro I was in search of a new device.&#160; For months, I had ignored everyone from friends to my Mom getting an iPhone.&#160; Finally a few weeks ago about 15 minutes before the AT&amp;T store closed I decided to grab one and give it a try.&#160; </p>  <p>I lasted almost 3 weeks before I terminated the experiment due to a few different issues.&#160; But before I did, I learned some interesting things.</p>  <p><em><b>I didn’t mind paying a small amount for useful apps – </b></em><em> The under $3 applications make it so easy to not ponder too much about the decision to try it. The integrated application store is clearly what makes this so easy. I ponder, if micro transactions were easier all across the web would people be willing to part with their money more often?</em></p>  <p><em><b>Free applications are a powerful business tool</b></em><em> – Just before walking into a restaurant the other night I made a reservation with Open Table’s application and just as we walked in it popped on the managers screen. News papers, Chipotle, Fandango there all there. Like the web made having a web page a requirement for a business the iPhone is having a similar effect in the mobile world. Today it’s the iPhone, but I suspect that’s just the catalyst that is helping people get comfortable with that type of interaction. </em></p>  <p><b><i>Not all phones have signal equality</i></b> - It’s not new that different phones will have different reception patterns but I have never seen a phone in this price range be so inferior. Last weekend we had a chance to drive from Colorado to Utah. On multiple occasions my iPhone was the only AT&amp;T phone in the car that was without signal. I travel a fair amount, and I have always enjoyed the fact that I arrive and my phone just works. I’ve had my other phones work on a boat, in remote areas and in other countries and never had I noticed such a difference to other AT&amp;T phones as I have with the iPhone.</p>  <p><b><i>AT&amp;T has a mini monopoly</i></b> - I can only imagine the executive meeting where they decided to stick it to customers that wanted to jump on the iPhone parade. I knew about the data plan requirements, I was used to that. I also knew that they didn’t allow tethering. But I didn’t know that the international data plan I was paying $60 a month for jumped to $150 for no other reason than I had an iPhone. This is one aspect of the iPhone I won’t miss and it’s clear AT&amp;T is milking every $ they can from the early iPhone adopters.</p>  <p><b><i>Google maps tracking was very jerky</i></b> – Visiting a number of cities I don’t know well I became a big fan of the Windows Live search application and using the Track GPS feature that would follow you on a map and give you close to real time navigation. The only quirk I found on my Treo Pro with this was it was sometimes slow to acquire the GPS signal. iPhone has the Google maps application that is ok, but in practice I found it to be very jerky when it was trying to track your progress. So much so if you tried to use it for navigation you might not know you passed a turn.</p>  <p><b><i>Apple’s figured out application interaction</i></b> – Sometimes (when it was working) I would use the iPhone to clear stuff out of my e-mail inbox. With just a swipe of my finger I could quickly delete an e-mail, bring it up, using two fingers to make the text larger. The multi select and delete had to be one of my favorite features. I also really liked how you could easily resize e-mails and web pages it made the mobile device really feel usable.</p>  <p><b><i>Connected Everywhere? Not yet!</i></b> – Apple may have great insight, but iPhone may be ahead of its time assuming that users will be connected everywhere. I was shocked on my first airplane trip when I started to delete a few e-mails only to get a cryptic error message saying it couldn’t move the message. It turns out that “offline” isn’t in apples vocabulary. I believe we will get there eventually, but today occasionally connected is still a necessity.</p>  <p><b><i>Physical Keyboard vs. More Screen Real Estate</i></b> – This is a tough one for me, I really liked the large screen area the iPhone had. In fact today being back on my Treo Pro I kept thinking how small the screen space is because of the keyboard. That said, there’s nothing like the feel of real keys when typing a message no matter how short the message is. The iPhone soft keyboard grew on me and I got better at it, but it still felt really clumsy compared to a real keyboard. Also, the correction algorithms that try to suggest spelling and word completion are very poor on the iPhone compared to what I’m used to on my Treo. At the end of the day though, I would trade physical keyboard for more screen space.</p>  <p><b><i>What’s with only supporting one Exchange Account </i></b>- This isn’t just an Apple thing, Windows Mobile does it too. It’s great that devices are starting to support multiple e-mail accounts but there needs to be support for multiple Exchange accounts as well. It’s clear that Exchange e-mail support was an afterthought for the iPhone. Beyond just the multiple account support, I found the error messages cryptic, and 3 or 4 times I had to completely reset my mail account to get things working again. This seemed a little better in the recent 3.1 upgrade but not much.</p>  <p><b><i>It was small but made a great reader</i></b> - Having the larger screen I was able to use the iPhone for reading e-mail, RSS feeds, FaceBook, News Papers and books. In fact, I really liked the Amazon Kindle reader. While some like the non-back light of the Kindle, for me the iPhone or iTouch represents just the right size for a carry anywhere device for reading stuff.</p>  <p>So between the coverage issues, the e-mail issues and the outrageous international data pricing I decided I could live without for now. Don’t get me wrong, I really liked the phone, it seemed to make me more productive. But something about having to keep resetting my e-mail and sometimes it causing the phone to not take inbound calls got on my nerves. So for now I’m a free agent, on the roam for a new phone. Maybe one of the new Windows mobile phones releasing in October will be interesting or maybe I will go through withdrawals and live with the iPhone quirks – Stay tuned!</p>]]></description><wfw:commentRss>http://blog.davidyack.com/journal/rss-comments-entry-5273520.xml</wfw:commentRss></item><item><title>RIA Services – Finding the InnerException</title><dc:creator>David Yack</dc:creator><pubDate>Thu, 10 Sep 2009 16:44:35 +0000</pubDate><link>http://blog.davidyack.com/journal/2009/9/10/ria-services-finding-the-innerexception.html</link><guid isPermaLink="false">154714:1437668:5150541</guid><description><![CDATA[<p>One of the challenges I&rsquo;ve run into with using RIA services is that sometimes you get back a message saying check InnerException only to find it is null.&nbsp;</p>
<p>&nbsp;</p>
<p>In the following example, I had deleted some data and submitted changes.&nbsp; I set a break point on the server side in the delete method so I knew that it&rsquo;s getting called and ran ok.&nbsp; Back on the client side I would see an exception when checking the results of the submit operation as you can see in the following example.&nbsp; The catch is notice that the message tells me to check the InnerException which is null!</p>
<p><a href="http://blog.davidyack.com/resource/WindowsLiveWriter/RIAServicesFindingyourInnerException_9549/?fileId=4107599"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" src="http://blog.davidyack.com/resource/WindowsLiveWriter/RIAServicesFindingyourInnerException_9549/?fileId=4107600" border="0" alt="image" width="525" height="121" /></a></p>
<p>&nbsp;</p>
<p>While I clearly believe this is a bug and have reported it, I wanted to share how I track down what the real error is.&nbsp; The quickest path I have found is to override the PersistChangeSet method on the server DomainService.&nbsp; As you can see in the following example all I do is capture the error and I can set a break point.&nbsp; You can now quickly determine what the error is.&nbsp; If you want, this is also where you could &ldquo;fixup&rdquo; the exception to pass back a more meaningful message.</p>
<p>&nbsp;</p>
<p>Update: From Nikhil - He suggests overriding Submit which is a good sugestion, the idea is you need to catch the error server side in order to know the "why" so there's two places you can hook into if you want.</p>
<p>&nbsp;</p>
<p><a href="http://blog.davidyack.com/resource/WindowsLiveWriter/RIAServicesFindingyourInnerException_9549/?fileId=4107601"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" src="http://blog.davidyack.com/resource/WindowsLiveWriter/RIAServicesFindingyourInnerException_9549/?fileId=4107602" border="0" alt="image" width="525" height="247" /></a></p>]]></description><wfw:commentRss>http://blog.davidyack.com/journal/rss-comments-entry-5150541.xml</wfw:commentRss></item><item><title>Kicking the tires on SQL Azure</title><dc:creator>David Yack</dc:creator><pubDate>Tue, 25 Aug 2009 04:35:55 +0000</pubDate><link>http://blog.davidyack.com/journal/2009/8/25/kicking-the-tires-on-sql-azure.html</link><guid isPermaLink="false">154714:1437668:4998828</guid><description><![CDATA[<p>Last week I got my token to activate my SQL Azure service and took a few minutes to take it for a test drive.&#160; If you haven’t heard about SQL Azure it’s the re-launch of SQL Data Services (SDS).&#160; SDS used to be a much more restrictive model that really didn’t have any hope for sharing code between a traditional SQL Server and the cloud.&#160; At Mix09 it was announced that SDS was going to go through some major changes for the best and move towards allowing more fuller relational and a powerful subset of TSQL support.&#160; Recently in July, SDS was <a href="http://blogs.msdn.com/ssds/archive/2009/07/09/9827971.aspx">renamed</a> to SQL Azure to better align the name.</p>  <p>Like other Azure services once I got the token, I just went to the portal and there’s now a SQL Azure section – after registering my token it allowed me to create a SQL Azure Instance and then I proceeded to create a new database via the web interface – this all happened really fast and painless. Now with a new database, I set out to figure out how to connect using SQL Studio. From the portal you can get your connection information but there’s a few quirks with the CTP you have to deal with.&#160; Zach owns <a href="http://english.zachskylesowens.net/2009/08/18/connecting-to-sql-azure/">blog post</a> on using SQL Azure is the best place to start to figure out how to connect.&#160; Like I said it’s a little quirky, and you have to be patient with the timeouts that kick you off if you leave it idle, but the fact that I can use SQL Studio to query the data in the cloud was a huge plus!</p>  <p>Next, I wanted to move some table definitions from my local SQL server to my SQL Azure database.&#160; There’s not a copy /upload database option yet – lets hope that gets added but in the mean time I found a couple of things that worked.&#160; First, I tried the create script from within SQL Studio.&#160; Using that approach I copied it into my query window for the new database and gave it a try.&#160; You have to tweak the SQL some because things like Using database <a href="http://english.zachskylesowens.net/2009/08/19/use-database-statement-is-not-supported-in-sql-azure-ctp1/">isn’t supported in the CTP</a>&#160; There’s some other keywords that aren’t supported either I just kept deleting them till I got my table create to run!</p>  <p>After some experimenting I actually found using Red Gates compare was the best approach because it would script multiple tables at once and the SQL seemed to be cleaner for what SQL Azure wanted (cleaner, not perfect I still had to do some tweaking).&#160; The way I tried this was to create another empty DB locally that I would do the compare against to create my script.&#160; That also worked as I modified and made changes to the tables I would just do the compare to that local copy and run the change script (slightly tweaked) on both the local copy and my SQL Azure db.&#160; Who knows, maybe Red Gate will come out with a version specifically for doing this as I bet they could get something out quicker than MS tweak SQL Studio.</p>  <p>The database I moved to SQL Azure had a few tables that supported an application that used Entity Framework.&#160; This is the part where I emphasize the improvements between the prior SDS and SQL Azure.&#160; I simply took my connection string, pointed it to the cloud&#160; and I was off and running.&#160; Now I’m not saying you will find SQL in the cloud a seamless transition for every application and clearly there are some inherit things that are different with SQL Azure that you need to learn.&#160; But compared to the prior SDS, I’m impressed and like where we are heading.&#160; After almost a week of running this small database in the cloud with an application I use daily, so far so good!</p>  <p>Speaking of learning, there’s a lot more info on the SQL Azure dev center on MSDN you can find that <a href="http://msdn.microsoft.com/en-us/sqlserver/dataservices/default.aspx">here</a>.</p>]]></description><wfw:commentRss>http://blog.davidyack.com/journal/rss-comments-entry-4998828.xml</wfw:commentRss></item><item><title>Windows 7 Upgrade or Repave?</title><dc:creator>David Yack</dc:creator><pubDate>Mon, 17 Aug 2009 04:44:07 +0000</pubDate><link>http://blog.davidyack.com/journal/2009/8/17/windows-7-upgrade-or-repave.html</link><guid isPermaLink="false">154714:1437668:4922724</guid><description><![CDATA[<p>That’s a decision many of you will be making in the future if you haven’t already.&#160; I’ve done both already and have had success with both approaches.&#160; I’m not sure there’s a single right answer to which choice you should make.&#160; I can tell you from past experience I tend to favor the re-pave as there’s just something about having a fresh install.&#160; On one of my machines, my main office computer, I decided to do the upgrade.&#160; Why you ask?&#160; It’s one I don’t put any beta software on and it’s the cleanest of all my computers. Yeah I have a few. </p>  <p>The upgrade was smooth, but not nearly as fast as a fresh install of the base Windows 7 OS.&#160; I’m not a time person so I didn’t get the stop watch out and watch, but I’d say if your doing an upgrade it took about an hour and a half to finish.&#160; I would advise if your doing an upgrade to set aside 3-4 hours just in case you hit some snags.&#160; Since I have multiple computers,. I’m not as worried if the upgrade had problems because I would just use another one.&#160; So if you only have one, take the time to get a good backup of your current system in case things go way wrong.</p>  <p>Installing from a bootable USB is the way to go if you ask me…. My laptops don’t have DVD drives because with 16, 32 and 64gb flash drives who needs a 4gb DVD that’s easily broken when you travel.&#160; In fact before now the only reason I would carry my external DVD player around was to re-install should the world end while I’m traveling.&#160; Now with Windows 7 , I used made a bootable USB using this utility <a href="http://blogs.technet.com/stephenrose/archive/2009/07/28/a-bootable-usb-utility-to-create-bootable-usb-drives-for-win-7-and-server-2008.aspx">here</a>.&#160; That will shave another pound off my travel bag!&#160; So far this has worked great and flash drives offer such good read performance the installs just fly.&#160; I’m not sure you can finish a cup of coffee anymore for the base Widows 7 installation.</p>  <p>So back to Upgrade vs. Re-Pave.&#160; Upgrades nice because all your stuff is just there still.&#160; After the upgrade finishes and the reboot is done you login and no more work is required.&#160; In some ways I think this is like real estate – some people buy a house and paint the walls pink, and put up all kinds of wall paper.&#160; They invest a lot of time making small tweaks to make it feel like home.&#160; Other people, just leave the walls alone knowing if they ever sell it’s less work in the future.&#160; For me, I don’t do a lot of those tweaks because I’m always re-installing.&#160; So for people that do a lot of “wall painting” you might want to consider upgrading because you don’t have to re-do the tweaks.&#160; So if you have a pretty clean PC with out any beta software or other odd stuff that you’ve installed – give upgrade a try – worse case you can always do a re-pave if you don’t like what you get!</p>  <p>So why just re-pave?&#160; It’s like cars&#160; some people will drive a car till it stops running, others will swap it out ever few years.&#160; For a Windows install the same is true – some only rebuild when they get a new computer, others are constantly rebuilding.&#160; For me,like the new car, I like the freshness that a new install has.&#160; It’s a quick way to dump all the junk you no longer need.&#160; I only install things I’m actively using so I end up with a streamlined install – no bloat you get when you upgrade and carry along those wonderful things you installed and only used once.&#160; </p>  <p>If your doing a re-pave the actual install of Windows 7 plus Microsoft Office goes really quick.&#160; Where things slow down is if your a developer getting Visual Studio 2008 and SQL 2008 all setup.&#160; In fact, the slowest part is the service packs to both of those.&#160; You have the actual Visual Studio 2008 SP1 that must install, then once those are installed expect almost 1Gb of follow on updates that come down through windows update.&#160; Visual Studio SP1 I think takes almost 4 times as long as Windows (remember my disclaimer I don’t pay attention to time, but it sure seems like forever) to install.&#160; I always recommend not doing a fresh install when you plan to go on the road soon because you will find that you trickle install things over the next few days.&#160; Even when I make a list of things I use all the time sure enough I forget something stupid like Adobe PDF Reader.</p>  <p>Finally, you will notice the title wasn’t Windows 7 Upgrade, Repave or “Don’t bother looking at Windows 7” so you can assume my recommendation is to move to Windows 7 when it becomes available to you.&#160; I’ve been running it on all but one of my machines during the beta and couldn’t be more happy.&#160; As to my favorite feature?&#160; The fact that when you hit “Sleep” it just sleeps, and when you open the lid on your laptop it just flashes on with out delay.</p>  <p>So what’s are you going to do upgrade or repave, or what did you do and how did it work?</p>]]></description><wfw:commentRss>http://blog.davidyack.com/journal/rss-comments-entry-4922724.xml</wfw:commentRss></item><item><title>Behavior to Control DataForm AutoGenerate</title><dc:creator>David Yack</dc:creator><pubDate>Tue, 11 Aug 2009 06:03:39 +0000</pubDate><link>http://blog.davidyack.com/journal/2009/8/11/behavior-to-control-dataform-autogenerate.html</link><guid isPermaLink="false">154714:1437668:4870026</guid><description><![CDATA[<p>The <strong>DataForm</strong> like the <strong>DataGrid</strong> control by default has the ability to auto generate fields based on the public properties of the object bound it.&#160; This is controlled by the AutoGenerateFields property which is set to true by default.&#160; I think the most common use for this feature is building demo apps and prototyping.&#160; In those types of uses you can usually overlook the fact that there are a few properties with fields generated that you would never show a user of a business application.&#160; In the rest of this blog post I will walk you through how you can add more control using a Silverlight 3 Behavior.</p>  <p>You can now also have more control over field generation by adding attributes to the class that you are binding to using the Editable and Display attributes.&#160; Editable allows you to mark the property to be treated as read only or generate a one way binding.&#160; Display as used below sets the AutoGenerateField property to false to ensure that the Age property doesn’t generate a UI Element.</p>  <p><a href="http://blog.davidyack.com/resource/WindowsLiveWriter/BehaviortoControlDataFormAutoGenerate_150CD/?fileId=3824745"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.davidyack.com/resource/WindowsLiveWriter/BehaviortoControlDataFormAutoGenerate_150CD/?fileId=3824746" width="334" height="107" /></a> </p>  <p>You might have done similar things during the Silverlight 3 beta using the Bindable attribute which was replaced by using Display and Editable – see the <a href="http://msdn.microsoft.com/en-us/library/cc645049(VS.95).aspx">change doc</a> for more details.&#160; </p>  <p>If you are using .NET RIA Services it helps by projecting attributes you place on the server side class metadata to the Silverlight client code generated.&#160; When binding a class projected to the client by RIA services no extra work is required because these attributes are there.</p>  <p>These attributes help a lot and make it so there are even more places where the DataForm can be used.&#160; One of the problems though is there are times where either you don’t want to mess with meta data, don’t have control over the class to add meta data, want a different set of fields included or excluded for a particular use.&#160; In any of those cases probably the most common suggested work around is setting the AutoGenerateFields to false and specify a specific list of fields.&#160; That can get real tedious real quick especially if you just wanted to hide a couple of fields.</p>  <p>The DataForm provides a useful event to help out here it’s called AutoGeneratingField.&#160; This event is called as the DataForm is about to generate a field for a property.&#160; In the event arguments you are passed the property name, the property type, a Field property and finally a Cancel flag.&#160; The Field property is used if you want to provide a DataField back based on your own evaluation of the property name or type.&#160; The Cancel flag though is what were most interested in for this blog post because it allows you to cancel generation of a field.&#160; Using an event handler on that event you could accomplish the same thing we did with the attribute above as you can see in the following example.</p>  <p><a href="http://blog.davidyack.com/resource/WindowsLiveWriter/BehaviortoControlDataFormAutoGenerate_150CD/?fileId=3824765"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blog.davidyack.com/resource/WindowsLiveWriter/BehaviortoControlDataFormAutoGenerate_150CD/?fileId=3824766" width="515" height="111" /></a> </p>  <p>While that’s helpful, I was really hoping for a way to package it up to be a little more reusable.&#160; One way you could do that is inherit your own MyDataForm class from DataForm and override the OnAutoGenerateField method as you can see in the following example.</p>  <p><a href="http://blog.davidyack.com/resource/WindowsLiveWriter/BehaviortoControlDataFormAutoGenerate_150CD/?fileId=3824767"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blog.davidyack.com/resource/WindowsLiveWriter/BehaviortoControlDataFormAutoGenerate_150CD/?fileId=3824768" width="519" height="139" /></a>&#160; </p>  <p>I’ve of course over simplified this a little but you get the point.&#160; I basically have a property that can pass in the fields I want and if not in the list I cancel the generation.&#160; I would probably also include an ExcludeFields property as well so you could stop one or two fields from generating.&#160; Both can be useful in making the DataForm useful for more scenarios.&#160; The problem with this approach is that you then have to always use the MyDataForm class to get the benefit.&#160; In the next example we will look at how to use a Silverlight Behavior.</p>  <p>Behaviors and Triggers are a new feature that we gained with Silverlight 3 and are packaged as part of the blend SDK in the System.Windows.Interactivity assembly.&#160; They are nice because they let you add capabilities to existing controls without having to inherit from the control. In the rest of this post we are going to build a behavior to allow us to filter the fields.&#160; The first thing that needs to be done after we add a reference to the System.Windows.interactivity assembly is to create our class that inherits from Behavior as you see below.</p>  <p><a href="http://blog.davidyack.com/resource/WindowsLiveWriter/BehaviortoControlDataFormAutoGenerate_150CD/?fileId=3824769"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blog.davidyack.com/resource/WindowsLiveWriter/BehaviortoControlDataFormAutoGenerate_150CD/?fileId=3824770" width="512" height="36" /></a> </p>  <p>You will notice that we specify DataForm as the control type for the behavior – this allows us to have a typed property AssociatedObject that is of type DataForm.&#160; </p>  <p>What we want to do is hook into the AutoFieldGeneratingEvent like we did in the past examples.&#160; Behaviors provide an OnAttached method that you can override and accomplish registering the event handler as you can see below.</p>  <p><a href="http://blog.davidyack.com/resource/WindowsLiveWriter/BehaviortoControlDataFormAutoGenerate_150CD/?fileId=3824771"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blog.davidyack.com/resource/WindowsLiveWriter/BehaviortoControlDataFormAutoGenerate_150CD/?fileId=3824772" width="519" height="75" /></a> </p>  <p>In the event handler we basically use similar logic like we did in the prior example or more fancy if we want but the idea is for fields we want to not show we set the Cancel flag.&#160; </p>  <p>Using the behavior is pretty easy the first thing you need to do is declare a namespace reference for the System.Windows.Interactivity and the library that contains the behavior class as you can see below.</p>  <p><a href="http://blog.davidyack.com/resource/WindowsLiveWriter/BehaviortoControlDataFormAutoGenerate_150CD/?fileId=3824773"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blog.davidyack.com/resource/WindowsLiveWriter/BehaviortoControlDataFormAutoGenerate_150CD/?fileId=3824774" width="509" height="31" /></a> </p>  <p>Then on the DataForm control instance we can hook up our behavior by using the Interaction.Behaviors markup as you can see below.</p>  <p><a href="http://blog.davidyack.com/resource/WindowsLiveWriter/BehaviortoControlDataFormAutoGenerate_150CD/?fileId=3824775"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blog.davidyack.com/resource/WindowsLiveWriter/BehaviortoControlDataFormAutoGenerate_150CD/?fileId=3824776" width="513" height="89" /></a> </p>  <p>Behaviors are cool because they can easily attach on to an existing control to add behavior that makes sense.&#160; By attaching on they keep the core control from becoming bloated with features that only get used once and&#160; a while.</p>  <p>If you think this might be useful to you, drop me an <a href="http://blog.davidyack.com/contact-me/">e-mail</a> and I will shoot you over a copy of the code.</p>]]></description><wfw:commentRss>http://blog.davidyack.com/journal/rss-comments-entry-4870026.xml</wfw:commentRss></item><item><title>Can HTML Keep up with other RIA technologies?</title><dc:creator>David Yack</dc:creator><pubDate>Sat, 08 Aug 2009 10:48:53 +0000</pubDate><link>http://blog.davidyack.com/journal/2009/8/8/can-html-keep-up-with-other-ria-technologies.html</link><guid isPermaLink="false">154714:1437668:4844493</guid><description><![CDATA[<p>One thing for sure there hasn’t been a dull moment in technology for a while.&#160; The ever increasing pace of change can make it almost as challenging as picking stocks to know which technology to choose.</p>  <p>HTML is one of the interesting technologies because it has been the foundation of the web evolution.&#160; Without going back on a history trip, lets just agree its been around for a while.&#160; Last updated with the HTML 4.01 specification back in 1999, and with a new HTML 5 specification in the works.</p>  <p>Recently, there’s been a lot of hype around HTML 5.&#160; In fact almost enough you might think it’s ready to go and fully supported.&#160; But as Philippe Le Hegaret simply stated on the <a href="http://www.w3.org/QA/2009/05/_watching_the_google_io.html">W3C blog</a> “HTML 5 isn’t a standard yet”&#160; The first draft of HTML 5 can be traced back over a year to January 2008.&#160; The most recent draft was just recently published.&#160; One challenge with HTML 5 is not all the players have been at the table.&#160; In fact Microsoft has just <a href="http://news.cnet.com/8301-1001_3-10305822-92.html">recently joined in</a>, up till now it’s been a Google/ Apple show.</p>  <p>What’s the rush for HTML 5?&#160; Simple, HTML hasn’t kept pace with other emerging RIA technologies like Flash and Silverlight.&#160; HTML 5 promises a lot of fancy new features like built in video, audio, and local data storage to name a few that will close the gap.&#160; This has lead <a href="http://www.networkworld.com/news/2009/061609-html-5-could-it-kill.html">some</a> to speculate if HTML 5 could be the death to Flash, Silverlight and other RIA technologies. I wouldn’t call your florist and order flowers for the funerals just yet….</p>  <p>Why you ask?&#160; HTML 5 is in a fight with some very nimble competing technologies.&#160; The RIA space has been fire with new features being released at neck breaking speed. Most RIA technologies like Flash and Silverlight have streamlined their release cycles to 9 months or less because they don’t have to battle it out with a standards committee.&#160; Most of the competing technologies simply depend on the object tag in HTML to host their plug-in and then they manage the plug-in area as they see fit.&#160;&#160;&#160; That means that Adobe only has to agree with them self for Flash changes, and same for Microsoft with Silverlight.&#160; HTML 5 has two big challenges.&#160; First, getting all the players to approve the new specification.&#160; Second, and probably an even more challenging aspect is to get it implemented in a consistent way in enough users browsers.&#160; Even today, with the push towards standards in IE8 most the time unless you have a real simple page it won’t look the same the first time you run it in the different browsers.&#160; In fact, sometimes they look radically different!</p>  <p>Like movie sequels you can’t help but think are we just trying to make HTML like all the other popular movies instead of letting it do what it was designed to do originally.&#160; By trying to morph it to be closer to RIA technologies do we risk causing even more fragmentation?&#160; I know for me, writing an application that just works in different browsers and even out of the browser is compelling.&#160; Anytime I spend time working on resolving a browser compatibility issue I feel it’s 100% wasted time that I could have spent building something with higher business value.&#160; Am I against standards?&#160; No, I think they have their place, however, the more complex they get the harder it is to get consensus and compliance.&#160; </p>  <p>So what do you think about HTML 5? Should we start a pool of when it will finally be approved?&#160; </p>]]></description><wfw:commentRss>http://blog.davidyack.com/journal/rss-comments-entry-4844493.xml</wfw:commentRss></item><item><title>RIA Services Staying Logged In</title><dc:creator>David Yack</dc:creator><pubDate>Wed, 29 Jul 2009 06:51:59 +0000</pubDate><link>http://blog.davidyack.com/journal/2009/7/29/ria-services-staying-logged-in.html</link><guid isPermaLink="false">154714:1437668:4775423</guid><description><![CDATA[<p>One of the more useful services that comes out of the box with .NET RIA Services is an authentication service.&#160; In fact, if you create an application using the Silverlight Business Application template it comes already wired up for use with the ASP.NET authentication system.&#160; Brad Abrams has a good walkthrough of the basics of using this service <a href="http://blogs.msdn.com/brada/archive/2009/07/13/business-apps-example-for-silverlight-3-rtm-and-net-ria-services-july-update-part-3-authentication.aspx">here</a>.</p>  <p>As configured when you create your new application using this template the login is not retained from one browser session to the next.&#160; We are in the process of building a training center application and a frequent request from users is to not have to log in each time.&#160; They would like to be able to click “Keep me logged in” and have it be retained for a period of time.&#160; In the rest of this blog post I’m going to walk through one of the ways to enable this using the .NET RIA Services authentication service.</p>  <p>The first step is to modify the LoginWindow to have a check box to allow the user to indicate they want to stay logged in as you can see in the following image.</p>  <p><a href="http://blog.davidyack.com/resource/WindowsLiveWriter/RIAServicesStayingLoggedIn_724/?fileId=3714238"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.davidyack.com/resource/WindowsLiveWriter/RIAServicesStayingLoggedIn_724/?fileId=3714239" width="315" height="135" /></a> </p>  <p>This requires a simple addition to the XAML for the LoginWindow as you can see below.</p>  <p>&lt;StackPanel Style=&quot;{StaticResource LoginControlStyle}&quot;&gt;    <br />&#160;&#160;&#160; &lt;TextBlock Text=&quot;&quot; Style=&quot;{StaticResource LoginTextStyle}&quot;/&gt;     <br />&#160;&#160;&#160; &lt;CheckBox x:Name=&quot;checkStayLoggedIn&quot; Content=&quot;Stay logged in 2 weeks&quot;&gt;&lt;/CheckBox&gt;     <br />&lt;/StackPanel&gt; </p> We chose two weeks because of the type of application you can make this as long or as short as you would like.&#160; Really what we are going to use this for is to decide if we check the persisted property on the Login call.&#160; Previously, our login call looked like the following just passing the user and password.&#160; <p>_authOp = _authService.Login(this.loginUserNameBox.Text, this.loginPasswordBox.Password);</p>  <p>We are going to change this logic to to set the IsPersited property on the LoginParameters as you can see in the following revised code.</p>  <p>LoginParameters loginParms = new LoginParameters(this.loginUserNameBox.Text,    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.loginPasswordBox.Password, checkStayLoggedIn.IsChecked.Value, string.Empty);     <br />_authOp = _authService.Login(loginParms);</p>  <p>Now because we said we are going to keep them logged in for 2 weeks, we also need to make a small change server side to the authentication section in the web.config.&#160; Here we are going to add a Forms timeout with a value in minutes.</p>  <p>&lt;authentication mode=&quot;Forms&quot;&gt;    <br />&#160; &lt;forms timeout=&quot;20160&quot;/&gt;     <br />&lt;/authentication&gt;</p>  <p>So at this point that all works, however, when we revisit the application it doesn’t know we are already logged in.&#160; In order to know that, we need to add a call to the LoadUser method.&#160; In this particular application in the MainPage loaded event handler we are showing the LoginWindow by default to allow the user to login.&#160; Our revised code now calls the LoadUser async method from the loaded event handler as you can see below.</p>  <p>AuthenticationService _authService = RiaContext.Current.Authentication;</p>  <p>var loadUserOp = _authService.LoadUser();    <br />loadUserOp.Completed += new EventHandler(loadUserOp_Completed);</p>  <p>Finally, when this completes it calls the loadUserOp_Completed event handler and we can check to see if the user is logged in and if not show the LoginWindow</p>  <p>void loadUserOp_Completed(object sender, EventArgs e)    <br />{     <br />&#160;&#160;&#160; if (!RiaContext.Current.User.IsAuthenticated)     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; new LoginWindow().Show();     <br />}</p> In the case where the user had persisted the login the IsAuthenticated is now set to true and we don’t show the LoginWindow.   ]]></description><wfw:commentRss>http://blog.davidyack.com/journal/rss-comments-entry-4775423.xml</wfw:commentRss></item><item><title>RIA Services DomainDataSource.Data not updating</title><dc:creator>David Yack</dc:creator><pubDate>Tue, 21 Jul 2009 23:23:13 +0000</pubDate><link>http://blog.davidyack.com/journal/2009/7/21/ria-services-domaindatasourcedata-not-updating.html</link><guid isPermaLink="false">154714:1437668:4707168</guid><description><![CDATA[<p>One thing I noticed in the July CTP of .NET RIA Services was that my Data Grids were no longer updating automatically when I added records via the associated DomainContext.&#160; This is due to an intentional change the team made to make the DomainDataSource play better with a broader set of scenarios.&#160; Jeff Handley has a good post on the forums ( <a href="http://silverlight.net/forums/p/111826/254748.aspx#254748">here</a> ) that explains the change in more detail and how to handle it going forward.&#160; </p>  <p>Basically, the DomainDataSource (DDS) will now only display entities it knows about.&#160; So as Jeff says in his post, only the top level entities that came back from a load operation or those added through the DDS.DataView collection.&#160; So then you ask, how do I add records that can show up immediately without having to refresh the DDS.&#160; Using the IEditibleCollectionView interface on the DataView property you can use the AddNew method to create an instance the entity.&#160; When your done with the records you need to call the CommitNew or CancelNew depending on what you want to happen with that object.&#160; There’s also a set of methods for edit – EditItem, CommitEdit, CancelEdit for when your working with modifying.</p>  <p>First of all, the IEditableCollectionView is located now in the System.Windows.Data assembly.&#160; When I first tried to get this all working I had to hunt around a bit to find that.&#160; Because the DDS DataView property is natively typed as ICollectionView you must cast it to an IEditableCollectionView to get access to the above methods.&#160; var myNewObj =&#160; ((IEditableCollectionView)myDDS.DataView).AddNew() as Course;</p>  <p>After doing that a few times, I got tired of all the casting and have suggested they wrap that up to be a little more friendly to use.&#160; Until that happens, I have a MyDomainDataSource that inherits from DomainDataSource that I threw in a few helper methods to make it a little cleaner to work with.&#160; Here’s the methods – feel free to use them if they will help you out.&#160; One thing you will notice is I combined the Commit and Cancel methods for Add and Edit.&#160; I’ve yet to track down a good reason that they are separate and require you to decide which to call upon completion of a modification session against the object.&#160;&#160; </p>  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; public DataType AddNew&lt;DataType&gt;()    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var ecv = ((IEditableCollectionView)this.DataView);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return (DataType) ecv.AddNew();     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </p>  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; public void EditItem(object itemToEdit)    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var ecv = ((IEditableCollectionView)this.DataView);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ecv.EditItem(itemToEdit);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </p>  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; public void CommitNewAndEdit()    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var ecv = ((IEditableCollectionView)this.DataView);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (ecv.IsAddingNew)     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ecv.CommitNew(); </p>  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (ecv.IsEditingItem)    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ecv.CommitEdit();&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </p>  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; public void CancelNewAndEdit()    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var ecv = ((IEditableCollectionView)this.DataView);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (ecv.IsAddingNew)     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ecv.CancelNew(); </p>  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (ecv.IsEditingItem)    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ecv.CancelEdit();</p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }   ]]></description><wfw:commentRss>http://blog.davidyack.com/journal/rss-comments-entry-4707168.xml</wfw:commentRss></item><item><title>Snapshot of the Silverlight 4 Wish list</title><dc:creator>David Yack</dc:creator><pubDate>Thu, 02 Jul 2009 04:37:25 +0000</pubDate><link>http://blog.davidyack.com/journal/2009/7/2/snapshot-of-the-silverlight-4-wish-list.html</link><guid isPermaLink="false">154714:1437668:4497047</guid><description><![CDATA[<p>It’s only been about 9 months since Silverlight 2 was <a href="http://weblogs.asp.net/scottgu/archive/2008/10/14/silverlight-2-released.aspx">released</a> in October 2008, we are nearing the release of Silverlight 3, and already the momentum is building for Silverlight 4.&#160; A thread recently has been started on the Silverlight forum to capture people’s wish list.&#160; You can read the full forum thread <a href="http://silverlight.net/forums/p/102856/240186.aspx">here</a> and add on your own wishes.&#160;&#160; </p>  <p>I’m preparing to finish writing part of a chapter that talks about “The Road Ahead” for our soon to be released Silverlight 3 book so I had some help pulling together a summary of what people are asking for already as of today.&#160; The following is just a snapshot but thought you might find it interesting if you didn’t have time to read the long forum list – The top 10 or so on the list all had multiple people requesting those items.</p>  <table border="0" cellspacing="0" cellpadding="0"><tbody>     <tr>       <td width="342">Printing support</td>     </tr>      <tr>       <td>Right-click context menus</td>     </tr>      <tr>       <td>Host HTML content</td>     </tr>      <tr>       <td>Better shaders</td>     </tr>      <tr>       <td>Better mouse support</td>     </tr>      <tr>       <td>Fix WriteableBitmap</td>     </tr>      <tr>       <td>Mic support</td>     </tr>      <tr>       <td>Better LocalMessage APIs</td>     </tr>      <tr>       <td>Better File IO Support</td>     </tr>      <tr>       <td>Full 3D w/GPU acceleration</td>     </tr>      <tr>       <td>WebCam support</td>     </tr>      <tr>       <td>Concurrent release on Linux </td>     </tr>      <tr>       <td>Audio streaming</td>     </tr>      <tr>       <td>Chrome in OOB applications</td>     </tr>      <tr>       <td>Deep linking/Navigation in OOB apps</td>     </tr>      <tr>       <td>Reconsider OOB model</td>     </tr>      <tr>       <td>Export UI as bitmap</td>     </tr>      <tr>       <td>Complete source code for controls</td>     </tr>      <tr>       <td>Better Unit Testing</td>     </tr>      <tr>       <td>Text right to left</td>     </tr>      <tr>       <td>Mobile support</td>     </tr>      <tr>       <td>Better tables (merge columns and such)</td>     </tr>      <tr>       <td>Copy text from a textblock</td>     </tr>      <tr>       <td>Make TCP/IP compatible w/Flash</td>     </tr>      <tr>       <td>SQL reports</td>     </tr>      <tr>       <td>Expose PixelShader.SetStreamSource()</td>     </tr>      <tr>       <td>Improve rendering performance</td>     </tr>      <tr>       <td>Tweening/morphing support</td>     </tr>      <tr>       <td>Intellisense in XAML for Blend</td>     </tr>      <tr>       <td>Animated images</td>     </tr>      <tr>       <td>Pop-up Silverlight windows</td>     </tr>      <tr>       <td>Faster Silverlight windowless mode</td>     </tr>      <tr>       <td>Silverlight as ActiveX control</td>     </tr>      <tr>       <td>Better compression</td>     </tr>      <tr>       <td>Custom Open/Save file dialogs</td>     </tr>      <tr>       <td>Complete DX10 support</td>     </tr>      <tr>       <td>Silverlight apps directly installed OOB</td>     </tr>   </tbody></table>]]></description><wfw:commentRss>http://blog.davidyack.com/journal/rss-comments-entry-4497047.xml</wfw:commentRss></item></channel></rss>
