ebook img

MSDN Magazine PDF

102 Pages·2011·21.63 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview MSDN Magazine

THE MICROSOFT JOURNAL FOR DEVELOPERS APRIL 2011 VOL 26 NO 4 WINDOWS AZURE COLUMNS TOOLBOX F# Tools and Resources Introducing the Windows Azure Terrence Dorsey page 8 AppFabric Caching Service CUTTING EDGE Karandeep Anand and Wade Wegner ........................................ 26 Give Your Classes a Software Contract CQRS on Windows Azure Dino Esposito page 12 Mark Seemann ......................................................................... 36 DATA POINTS Parsing Log Files with F#, MapReduce Composing WPF DataGrid Column Templates for a and Windows Azure Better User Experience Noah Gift ................................................................................ 44 Julie Lerman page 20 MOBILE MATTERS PLUS: Windows Phone Navigation, Visual Studio TFS Team Project Part 2: Advanced Recipes Yochay Kiriaty and and Collection Guidance Jaime Rodriguez page 82 Willy-Peter Schaub and Mike Schimmel ..................................... 50 UI FRONTIERS Lissajous Animations in Silverlight Use Bee Colony Algorithms to Charles Petzold page 88 Solve Impossible Problems DON’T GET ME STARTED James McCaffrey ...................................................................... 56 The Cat Butt Factor David Platt page 96 Introduction to WebMatrix Clark Sell ................................................................................. 72 ... ............................................................................................ Using Quince™, you and your team can collaborate on the user interface using wireframes, designs and examples. ....................................................................... Then use NetAdvantage® UI controls, like the map control used here, to bring the application to life quickly & easily. Untitled-7 2 11/10/10 10:59 AM .............................................................................................................................. From start to finish, Infragistics gives you the tools to create impressive user experiences that'll make end users happy! ... SEE HOW WE USE THE TOOLS TO CREATE THIS KILLER APP AT INFRAGISTICS.COM/IMPRESS Infragistics Sales 800 231 8588 • Infragistics Europe Sales +44 (0) 800 298 9055 • Infragistics India +91 80 4151 8042 • @infragistics Untitled-7 3 11/10/10 10:59 AM Untitled-2 2 3/8/11 10:21 AM Untitled-2 3 3/8/11 10:21 AM magazine APRIL 2011 VOLUME 26 NUMBER 4 LUCINDA ROWLEY Director KIT GEORGE Editorial Director/[email protected] KERI GRASSL Site Manager KEITH WARD Editor in Chief/[email protected] TERRENCE DORSEY Technical Editor DAVID RAMEL Features Editor WENDY GONCHAR Managing Editor KATRINA CARRASCO Associate Managing Editor SCOTT SHULTZ Creative Director JOSHUA GOULD Art Director CONTRIBUTING EDITORS K. Scott Allen, Dino Esposito, Julie Lerman, Juval Lowy, Dr. James McCaffrey, Ted Neward, Charles Petzold, David S. Platt Henry Allain President, Redmond Media Group Matt Morollo Vice President, Publishing Doug Barney Vice President, Editorial Director Michele Imgrund Director, Marketing Tracy Cook Online Marketing Director ADVERTISING SALES: 508-532-1418/[email protected] Matt Morollo VP, Publishing Chris Kourtoglou Regional Sales Manager William Smith National Accounts Director Danna Vedder Microsoft Account Manager Jenny Hernandez-Asandas Director Print Production Serena Barnes Production Coordinator/[email protected] Neal Vitale President & Chief Executive Offi cer Richard Vitale Senior Vice President & Chief Financial Offi cer Michael J. Valenti Executive Vice President Abraham M. Langer Senior Vice President, Audience Development & Digital Media Christopher M. Coates Vice President, Finance & Administration Erik A. Lindgren Vice President, Information Technology & Application Development Carmel McDonagh Vice President, Attendee Marketing David F. Myers Vice President, Event Operations Jeffrey S. Klein Chairman of the Board MSDN Magazine (ISSN 1528-4859) is published monthly by 1105 Media, Inc., 9201 Oakdale Avenue, Ste. 101, Chatsworth, CA 91311. Periodicals postage paid at Chatsworth, CA 91311-9998, and at additional mailing offi ces. Annual subscription rates payable in US funds are: U.S. $35.00, International $60.00. Annual digital subscription rates payable in U.S. funds are: U.S. $25.00, International $25.00. Single copies/back issues: U.S. $10, all others $12. Send orders with payment to: MSDN Magazine, P.O. Box 3167, Carol Stream, IL 60132, email [email protected] or call (847) 763-9560. POSTMASTER: Send address changes to MSDN Magazine, P.O. Box 2166, Skokie, IL 60076. Canada Publications Mail Agreement No: 40612608. Return Undeliverable Canadian Addresses to Circulation Dept. or XPO Returns: P.O. Box 201, Richmond Hill, ON L4B 4R5, Canada. Printed in the U.S.A. Reproductions in whole or part prohibited except by written permission. Mail requests to “Permissions Editor,” c/o MSDN Magazine, 4 Venture, Suite 150, Irvine, CA 92618. Legal Disclaimer: The information in this magazine has not undergone any formal testing by 1105 Media, Inc. and is distributed without any warranty expressed or implied. Implementation or use of any information contained herein is the reader’s sole responsibility. While the information has been reviewed for accuracy, there is no guarantee that the same or similar results may be achieved in all environments. Technical inaccuracies may result from printing errors and/or new developments in the industry. Corporate Address: 1105 Media, Inc., 9201 Oakdale Ave., Ste 101, Chatsworth, CA 91311, www.1105media.com Media Kits: Direct your Media Kit requests to Matt Morollo, VP Publishing, 508-532-1418 (phone), 508-875-6622 (fax), [email protected] Reprints: For single article reprints (in minimum quantities of 250-500), e-prints, plaques and posters contact: PARS International, Phone: 212-221-9595, E-mail: [email protected], www.magreprints.com/ QuickQuote.asp List Rental: This publication’s subscriber list, as well as other lists from 1105 Media, Inc., is available for rental. For more information, please contact our list manager, Merit Direct. Phone: 914-368-1000; E-mail: [email protected]; Web: www.meritdirect.com/1105 All customer service inquiries should be sent to [email protected] or call 847-763-9560. Printed in the USA Your best source for software development tools! ® LEADTOOLS Document UltraEdit VMware vSphere Imaging Suite SDK v17.0 The #1 Best Selling Text Editor Essentials Kit Bundle by LEAD Technologies in the World vSphere Essentials provides an all-in-one solution for small offices to virtualize three • Libraries for C/C++, .NET, Silverlight, by IDM physical servers for consolidating and Windows Phone, WPF, WCF & WF UltraEdit is the world’s standard in text managing applications to reduce hardware • High Performance OCR, ICR, MICR & OMR editors. Millions use UltraEdit as the and operating costs with a low up-front • 1D & 2D Barcodes (Read/Write) ideal text/hex/programmers editor investment. vSphere Essentials includes: • Forms Recognition/Processing on any platform — Windows, Mac, • VMware ESXi and VMware ESX or Linux! • PDF, PDF/A and XPS (deployment-time choice) Features include syntax highlighting Named User • Document Cleanup for nearly any programming language; 1-24 Users • VMware vStorage VMFS for 3 hosts • Advanced Compression (CCITT G3/G4, powerful Find, Replace, Find in Files, Paradise # • Four-way virtual SMP Paradise # Paradise # JBIG2, MRC, ABIC, ABC) and Replace in Files; FTP support, sort, I84 01201A01 • VMware vCenter Server Agent V55 85101C02 L05 03301A02 • High-Speed Scanning column mode, hex, macros/scripting, $59.95 • VMware vStorage APIs/VCB $446.99 • Print Capture and Document Writers large file handling (4+ GB), projects, • VMware vCenter Update Manager $4,018.99 templates, Unicode, and more. programmers.com/LEAD programmers.com/idm • VMware vCenter Server for Essentials programmers.com/vSphere Embarcadero RAD Studio XE Enterprise Architect TX Text Control 16.0 by Embarcadero Corporate Edition Word Processing Components Embarcadero®RAD Studio XE is a comprehen- Visualize, Document and TX Text Control is royalty-free, robust and sive application development suite and the Control Your Software Project powerful word processing software fdaasttae-sdtr iwveany atpop vliicsautaiollyn sb fuoilrd W GiUndI-oinwtesn, s.iNveE,T , bEnyt eSrppriaser xA rSchyitsetcet mis sa comprehensive, i•n r.eNuEsTa bWlein cFoomrmpos naenndt WfoPrmF .rich RVeleNeraesswioend! PHP and the Web. RAD Studio includes Delphi®, text box for VB.NET and C# integrated UML 2.1 modeling suite C++Builder®, Delphi Prism™, and RadPHP™. The providing key benefits at each stage of • ActiveX for VB6, Delphi, VBScript/HTML, ASP suite provides powerful compiled, managed system development. Enterprise Architect • File formats DOCX, DOC, RTF, HTML, and dynamic language support, heterogeneous Professional Edition NEW 7.5 supports UML, SysML, BPMN and XML, TXT RELEASE! dfraatmabeawsoer kcso nannedc taiv vitay,s tr itchhi rvdi-spuaartl yc oemcopsoynsteenmt otetshte ra nodp ecno nsstatrnudcat rrdesli atob lea,n awlyezlle u, nddeesri-gn, 1-4 Licenses • PDF and PDF/A export, PDF text import T79 1P2a1ra0d1iAse0 #1 that enable you to deliver applications up to stood systems. Additional plug-ins are Paradise # • Tables, headers & footers, text frames, $1,109.99 Paradise # 5x faster across multiple Windows, Web, and also available for Zachman Framework, SP6 03101A02 bullets, structured numbered lists,multiple CGI 15401A01 database platforms! MODAF, DoDAF and TOGAF, and to $182.99 undo/redo, sections, merge fields,columns Download a demo today. integrate with Eclipse and Visual Studio • Ready-to-use toolbars and dialog boxes $1,383.99 programmers.com/embarcadero 2005/2008. programmers.com/sparxsystems programmers.com/textcontrol ActiveReports 6 Mindjet®MindManager TuneUp Utilities™2011 by GrapeCity PowerTools version 9 for Windows® by TuneUp Distribution The de facto standard reporting tool Every Successful Project Starts The latest version of TuneUp Utilities™has been for Microsoft Visual Studio.NET with a Good Plan. designed with the need of small-to-medium businesses as well as government and educational • Fast and Flexible reporting engine by Mindjet® institutions in mind. TuneUp Utilities™will allow Mindjet MindManager®is information • Flexible event-driven API to completely you to reduce costly system downtime, extend mapping software that gives business control the rendering of reports system lifetime and allow your staff to work professionals a better way to conquer VENRE6SW!ION • WiVniceidlwuede irrna, gnA gdWeo ibnoedf oEFwxlapsso hFr toa ranmndsd P VPDirFeewvieerw, Wfoerbmats icpnorfonojceremcpta tpsti,loa dnne novinveeglor,lp oa asndtdr,a cbtoermgaiinemssu,t onsriimcma ptelify 1 User mW• oi tIrhne c merefofairsceeie dtnh tpalyen.r f3o0rm inatnucieti vaen tdo osylss,t eymou r ewsipllo bnesnee tfiimt ferom: Single User PPraorfaedssisioe n#a l Ed. •• RWXoCiynoadployty wd-Fse rpealepo pyLlmiicceaenntistoinnsg for Web and aprenlas uninlnttsiun.i gtMi vsieun cdvcMiesusasanflau fglr eaprmr®oejemwctaospr.ks fporro vide F15 1P7a4ra0d1iAse0 #1 ••• SGOorpeltuaimttieoarn l ssmy tsaotie namt el anrreaglnieac beniulimtyber of PC problems TU7 0P1a2ra0d1iAse0 #1 D03 04301A01 $293.98 $34.52 • Recovered disk space $1,310.99 programmers.com/grapecity programmers.com/mindjet programmers.com/tuneup New Intel Visual Microsoft SQL Server Win an iPad! Fortran Compiler Developer Edition 2008 R2 by Intel by Microsoft Place an Order for Software Intel®Visual Fortran Composer XE SQL Server 2008 Developer enables 2011includes the latest generation of Intel® developers to build and test applications (or Hardware) with Fortran compilers, Intel®Visual Fortran Compiler that run on SQL Server on 32-bit, ia64, and Programmer’s Paradise XE 12.0 for Windows. Intel®Fortran Composer x64 platforms. SQL Server 2008 Developer and You’ll be Entered XE is available for Linux and Mac OS X. This includes all of the functionality of Enterprise NEW package delivers advanced capabilities for Edition, but is licensed only for development, for a Drawing to Win RELEASE! development of application parallelism and test, and demo use. The license for SQL 2-bit/x64 an iPad Wi-Fi 32GB. winning performance for the full range of Intel® Server 2008 Developer entitles one developer IA64 DVD for Windows processor-based platforms and other compatible to use the software on as many systems Paradise # Single (SSR) platforms. It includes the compiler’s breadth of as necessary. For rapid deployment into Just Use the Offer Code TRWD04 M47 31101A04 Paradise # advanced optimization, multithreading, and production, instances of SQL Server 2008 When You Place Your Order Online or with I23 86101E03 processor support, as well as automatic proces- Developer can easily be upgraded to SQL $40.99 sor dispatch, vectorization, and loop unrolling. Server 2008 Enterprise without reinstallation. Your Programmer’s Paradise Representative. $263.99 programmers.com/intel programmers.com/microsoft 866-719-1528 programmersparadise.com Prices subject to change. Not responsible for typographical errors. Untitled-4 1 3/2/11 3:33 PM EDITOR’S NOTE KEITH WARD Cancel This! Do you develop Web sites that actively push users away? “Of course if I missed something on the Web site—was there a way to cancel not!” you respond. “What kind of addlepated fool would do that?” my subscription online that I didn’t see? Was I just dumb (always Maybe, uh, you—if you do one or more of these things, either at the a possibility with me)? behest of your boss(es), or because you think it will help drive sales. “No,” said the friendly voice on the other side. “Th ere’s no way to Th e thing that drove me away from a sports-related Web site last cancel your subscription on the Web site.” week was the simple act of trying to cancel my “premium content” I thought I must have misheard. So, you can sign up on the site— subscription. So I logged in to my account and looked up Settings. in fact, signing up and providing a credit-card number is as easy as I looked under my Subscriptions. I found my subscription. taking a bite of cheesecake—but you can’t cancel in the same way? Th en I looked around for how to cancel it. Nada. Th ere was a veri- table buff et of tabs: Profi les, Messages, Groups, Blogs and more. I Feeling a bit like Theseus, decided to click on Edit Profi le. Sensible enough, right? My Profi le should include information about my subscription, and a way to cancel. I wandered further into the labyrinth. El zippo—nothing useful there. OK, where to next? Hmm, let’s try Member Services. Surprise— more links! Th ey included yet another Profi le section, among other goodies. I didn’t have any luck in the previous Profi le section, so Th at’s right, I was told. Th en she tried to sell me on an even cheaper maybe this one had some deeper level of information, including version of my subscription. How thoughtful of her. how to cancel my account. To her credit, the lady was very professional and polite. So I Nope. Disappointed yet again. responded, just as politely (I hope), to pass along my complaint Aha! Account Information. Th at had to be it, especially as one about this sneaky, money-grubbing Web site and the company of the categories was Payment Methods. It did have lots of account that produces it. She said she would. information, including Payment Methods, which listed some old And maybe she even did. Of course, I’m sure my complaint was credit cards and a new one. Yikes—I didn’t know that old informa- placed in the “round fi le” equivalent of their e-mail system. tion was still there, so I deactivated all my old cards. So, aft er a long while of clicking around in a vain eff ort to fi nd I fi gured if I deactivated all my cards, my subscription would be a way to delete my subscription, I called a hard-to-locate phone automatically cancelled. But no: I couldn’t deactivate the current number, hoping that there might be a way to cancel. I lucked into credit card. Because, of course, I needed some way to pay for the the right number, and canceled. But, again, nowhere on the Web site subscription I no longer wanted. was I told how to cancel my subscription. Nary a word. So, feeling a bit like Th eseus, I wandered further into the labyrinth. Although I’m certain this company would give some long-winded I did searches on “cancel my subscription” and other phrases. rationale for this Web site design, there is, of course, just one reason If you’re guessing that I didn’t fi nd what I’m looking for, give for it: Th ey hope you get tired of looking, and give up the idea of yourself a one-handed clap. canceling because it’s not worth it. Th row up enough barriers, and Finally, I located a customer service number. Note that I didn’t fi nd any hope the poor schlub gets tired of scaling or going around them. number, link or written description of any kind that mentioned cancel- Word of advice: Don’t do this to your users. Don’t treat them like ing a subscription or account; I just stumbled across a phone number. suckers. Don’t try to bleed them in this cynical manner. All you’ll I called. Aft er a bit of shuffl ing around, I talked to someone who do is lose a customer forever. cancelled my subscription. Th inking that this was ridiculous, I asked Th e Golden Rule comes to mind. Visit us at msdn.microsoft.com/magazine. Questions, comments or suggestions for MSDN Magazine? Send them to the editor: [email protected]. © 2011 Microsoft Corporation. All rights reserved. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, you are not permitted to reproduce, store, or introduce into a retrieval system MSDN Magazine or any part of MSDN Magazine. If you have purchased or have otherwise properly acquired a copy of MSDN Magazine in paper format, you are permitted to physically transfer this paper copy in unmodifi ed form. Otherwise, you are not permitted to transmit copies of MSDN Magazine (or any part of MSDN Magazine) in any form or by any means without the express written permission of Microsoft Corporation. A listing of Microsoft Corporation trademarks can be found at microsoft.com/library/toolbar/3.0/trademarks/en-us.mspx. Other trademarks or trade names mentioned herein are the property of their respective owners. MSDN Magazine is published by 1105 Media, Inc. 1105 Media, Inc. is an independent company not affi liated with Microsoft Corporation. Microsoft Corporation is solely responsible for the editorial contents of this magazine. The recommendations and technical guidelines in MSDN Magazine are based on specifi c environments and confi gurations. These recommendations or guidelines may not apply to dissimilar confi gurations. Microsoft Corporation does not make any representation or warranty, express or implied, with respect to any code or other information herein and disclaims any liability whatsoever for any use of such code or other information. MSDN Magazine, MSDN, and Microsoft logos are used by 1105 Media, Inc. under license from owner. 6 msdn magazine Untitled-11 1 3/4/11 2:53 PM TOOLBOX TERRENCE DORSEY F# Tools and Resources F# is a new functional, type-safe programming language for the Microsoft .NET Framework. Developed at Microsoft Research, it’s based on Objective Caml, or OCaml, which is in turn based on ML. The creator of F#, Don Syme, calls it “a synthesis between type-safe, scalable, math-oriented scripting and programming for .NET.” It may be a relatively young language, but F# has quickly developed a cult following within the programming community. Perhaps that’s because F# lets you build on familiarity with the .NET Framework and Visual Studio. Perhaps it’s because F# combines functional, imperative and object-oriented programming techniques in a single language. Or perhaps it’s because F# is a strongly typed language that also supports the fl exibility of compile-time typing. Whichever aspects of the language appeal to you, here’s a guide to the tools and resources that will help you get the most out of F#. VSLab Math Visualizations in Visual Studio Getting Started If you’re using Visual Studio 2010 and the .NET Framework 4, you’ve And if you’re a die-hard Emacs user, don’t despair: Laurent Le already installed all the tools you need to start playing with F# 2.0. Brun is working on F# IntelliSense in Emacs (bit.ly/f3pd8b). Watch his You can also download a standalone installer for the F# 2.0 tools blog for details. (bit.ly/fGVQvl) if you want to use F# in a previous version of Visual Studio or in other development environments. Tools, Templates and Libraries Your next stop for learning about F# should be the Microsoft F# There are a variety of tools available to make F# easier and more Developer Center (msdn.microsoft.com/fsharp). Here you’ll fi nd docu- powerful. Your fi rst download should probably be the F# PowerPack mentation, links to examples, blog posts from F# experts and more. (fsharppowerpack.codeplex.com) from the F# development team. The Your core resource is going to be the F# Language Reference PowerPack includes source for the F# compiler and code library, plus (msdn.microsoft.com/library/dd233181) in the MSDN Library. This has all a number of additional tools and libraries. Among them are a the language details, along with sample code. Matrix library, tools for lexing and parsing, LINQ-based data access and tools for documenting F# libraries. Development Environments FAKE (github.com/forki/FAKE) is a build-automation system for F# As mentioned earlier, Visual Studio 2010 has deep support for F# designed with inspiration from tools like make and rake. FAKE lets you right out of the box. But if you want to experiment with the language leverage both functional programming techniques and direct access on other machines, or even other OSes, head over to the Try F# to .NET assemblies while also integrating directly with the editing and Web site (tryfs.net), where you can interactively code using F# in a debugging features of F#-aware IDEs like Visual Studio and SharpDevelop. browser-based interpreter. Head over to CodePlex to fi nd a couple of handy testing tools: Those without Visual Studio can grab a trial download as a standalone TickSpec (tickspec.codeplex.com) is a Behavior-Driven Development app or virtual machine from Microsoft (msdn.microsoft.com/vstudio/bb984878). framework that lets you describe behaviors in Gherkin (given, when, Aside from Visual Studio, there are a number of other free and then), and then execute the behaviors against C# and F# methods. commercial IDEs that directly support F# development. These FsUnit (fsunit.codeplex.com) is a unit-testing library. Simply drop the include SharpDevelop (sharpdevelop.net/OpenSource/SD), xacc.ide FsUnit.fs fi le into your project, then start writing test fi xtures and tests. (xacc.wordpress.com) and MonoDevelop (monodevelop.com). And FsCheck (fscheck.codeplex.com) is a randomized testing A unique aspect of MonoDevelop is that it enables you to set up framework based on the Haskell QuickCheck project that lets you your development environment on Windows, Mac OS X or Linux and write your test specifi cations in F#, C# or Visual Basic. target .NET Framework-based applications to those platforms in If you’re interested in Windows Phone 7 development, go to the addition to Android, iOS and Windows Phone 7. Functional Variations Visual Studio Gallery and grab the F# Library for Windows Phone has details on getting the F# features running; see “Installing and using (XNA) template (bit.ly/h5sg9h) and F# and C# Win Phone App F# in MonoDevelop” (functional-variations.net/monodevelop). Robert (Silverlight) template (bit.ly/fraF4S) for Visual Studio. Pickering also has a guide to using F# on Mac OS X and Linux with Speaking of Visual Studio again, here are two great projects that Mono (strangelights.com/fsharp/MonoLinux.aspx) on his F# Resources blog. will make working with F# much easier: F# Project Extender 8 msdn magazine

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.