Create Mobile Apps with HTML5, Javascript and Visual Studio
Total Page:16
File Type:pdf, Size:1020Kb
THE MICROSOFT JOURNAL FOR DEVELOPERS JANUARY 2014 VOL 29 NO 1 magazine Error-Handling Techniques in WinJS...........22 Create mobile apps with HTML5, JavaScript and Visual Studio DevExtreme Mobile is a single page application (SPA) framework for your next Windows Phone, iOS and Android application, ready for online publication or packaged as a store-ready native app using Apache Cordova (PhoneGap). With DevExtreme, you can target today’s most popular mobile devices with a single codebase and create interactive solutions that will amaze. Get started today… ・ Leverage your existing Visual Studio expertise. ・ Build a real app, not just a web page. ・ Deliver a native UI and experience on all supported devices. ・ Use over 30 built-in touch optimized widgets. Learn more and download your free trial devexpress.com/mobile All trademarks or registered trademarks are property of their respective owners. 0114msdn_CoverTip.indd 1 12/12/13 10:11 AM 0114msdn_CoverTip.indd 2 12/12/13 10:12 AM THE MICROSOFT JOURNAL FOR DEVELOPERS JANUARY 2014 VOL 29 NO 1 magazine Error-Handling Techniques in WinJS...........22 Build More Effi cient Windows Store Apps COLUMNS Using JavaScript: Error Handling WINDOWS WITH C++ Eric Schmidt ....................................................................22 Using Regular Expressions with Modern C++ Introducing Visual Studio Online Kenny Kerr 6 Ed Blankenship ................................................................32 DATA POINTS Code First Goodies Build Fault-Tolerant Composite Applications in Entity Framework 6 Ivan Krivyakov.................................................................40 Julie Lerman 12 TEST RUN Create Modern Microfi che Frequent Item-Sets for with the Chronicling America API Association Rule Learning James McCaffrey 70 Tim Kulp .........................................................................50 THE WORKING Troubleshooting Applications with IIS Logs PROGRAMMER Eduardo Sanabria .............................................................60 Getting Started with Oak: Database Interaction Unit Testing SQL Server OLAP Ted Neward 76 Cubes Using C# DON’T GET ME STARTED The Steam Drill Mark Nadelson ................................................................64 David Platt 80 Untitled-7 2 12/10/13 1:08 PM Untitled-7 3 12/10/13 1:07 PM ® JANUARY 2014 VOLUME 29 NUMBER 1 magazine Instantly Search MOHAMMAD AL-SABT Editorial Director/[email protected] KENT SHARKEY Site Manager Terabytes of Text MICHAEL DESMOND Editor in Chief/[email protected] DAVID RAMEL Technical Editor 25+ fielded and full-text search types SHARON TERDEMAN Features Editor WENDY HERNANDEZ Group Managing Editor dtSearch’s own document filters SCOTT SHULTZ Creative Director support “Office,” PDF, HTML, XML, ZIP, JOSHUA GOULD Art Director SENIOR CONTRIBUTING EDITOR Dr. James McCaffrey emails (with nested attachments), and CONTRIBUTING EDITORS Rachel Appel, Dino Esposito, Kenny Kerr, Julie Lerman, Ted Neward, Charles Petzold, David S. Platt, many other file types Bruno Terkaly, Ricardo Villalobos Supports databases as well as static and dynamic websites Henry Allain President, Redmond Media Group Michele Imgrund Sr. Director of Marketing & Audience Engagement Tracy Cook Director of Online Marketing Highlights hits in all of the above Irene Fincher Audience Development Manager APIs for .NET, Java, C++, SQL, etc. ADVERTISING SALES: 818-674-3416/[email protected] Dan LaBianca Vice President, Group Publisher Chris Kourtoglou Regional Sales Manager 64-bit and 32-bit; Win and Linux Danna Vedder Regional Sales Manager/Microsoft Account Manager David Seymour Director, Print & Online Production Serena Barnes Production Coordinator/[email protected] "lightning fast" Redmond Magazine Neal Vitale President & Chief Executive Offi cer Richard Vitale Senior Vice President & Chief Financial Offi cer "covers all data sources" eWeek Michael J. Valenti Executive Vice President Christopher M. Coates Vice President, Finance & Administration Erik A. Lindgren Vice President, Information Technology & Application Development "results in less than a second" David F. Myers Vice President, Event Operations Jeffrey S. Klein Chairman of the Board InfoWorld 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, hundreds more reviews and developer 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 case studies at www.dtsearch.com 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 dtSearch products: 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 Desktop with Spider Web with Spider 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 Network with Spider Engine for Win & NET . Media Kits: Direct your Media Kit requests to Matt Morollo, VP Publishing, 508-532-1418 (phone), 508-875-6622 (fax), [email protected] Publish (portable media) Engine for Linux 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/ Document filters also available for separate QuickQuote.asp licensing 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, Jane Long, Merit Direct. Phone: 913- 685-1301; E-mail: [email protected]; Web: www.meritdirect.com/1105 All customer service inquiries should be sent to [email protected] or call 847-763-9560. Ask about fully-functional evaluations The Smart Choice for Text Retrieval ® since 1991 www.dtSearch.com 1-800-IT-FINDS Printed in the USA Untitled-1 1 11/26/12 3:02 PM EDITOR’S NOTE MICHAEL DESMOND WinJS Takes the Next Step We recently surveyed MSDN Magazine readers and found that, Visual Studio 2013, which delivers key tooling improvements, with the exception of C#, more companies report working with including the ability to track down errors within chains of JavaScript than any other programming language—more than Java, asynchronous calls—an important capability given that WinJS apps more than C/C++, more than Visual Basic. So it should come as frequently chain promises to each other. no surprise that this month’s issue focuses on JavaScript develop- “When one of those promises errors out, you either need to ment for Windows Runtime. have an onError parameter for each promise in the chain, or you In his lead feature, “Build More Effi cient Windows Store Apps need to track down the error starting from the last promise in the Using JavaScript: Error Handling,” Eric Schmidt dives into some chain,” explains Schmidt, who says both approaches are time con- fundamental concepts of the Windows Library for JavaScript suming. “Th e Tasks pane, which has been extended to encompass (WinJS), including promises, asynchronous debugging, and error JavaScript code in Visual Studio 2013, really helps developers track handling. As Schmidt notes in an interview, the tooling and capa- down those errors in their code,” he notes. bilities of WinJS diff er from JavaScript in that the environment is Th e latest version of WinJS and its attendant tooling deliver what tailored for full-fl edged app development, rather than for Web sites. Schmidt describes as “ready to go” templates and controls that help And these diff erences are important to understand when ensuring streamline development. Th e updates also deliver signifi cant per- that fl aws in code and logic are properly handled. formance improvements and streamlined WinJS app development. “We provided new tools in Visual Studio 2013 for measuring HTML UI responsiveness, JavaScript memory usage, JavaScript Schmidt describes the JavaScript function timing and asynchronous debugging,” Schmidt says. “In the platform, we improved the performance of some of our existing window.onerror event as controls—for example, ListView—with APIs like the Dispose pattern and the Scheduler, as well as provided new controls that are “the catchall for error handling” better suited for specifi c tasks—for example, the Repeater control.” Speaking of performance improvements, next month Schmidt for Web apps. will publish a follow-on article focused