ASP.NET MVC 4 in Action a Revised Edition of ASP.NET MVC 2 in Action

Total Page:16

File Type:pdf, Size:1020Kb

ASP.NET MVC 4 in Action a Revised Edition of ASP.NET MVC 2 in Action ASP.NE IN ACTION Jeffrey Palermo Jimmy Bogard Eric Hexter Matthew Hinze Jeremy Skinner FOREWORD BY Phil Haack MANNING www.it-ebooks.info Praise for Earlier Editions of ASP.NET MVC in Action An authoritative source on ASP.NET MVC 2. Pick up this book! —Alessandro Gallo, Microsoft MVP ASP.NET MVC 2 in Action is a good read and an invaluable reference. —Derek Jackson, Software Architect, Harvard-Westlake Learn MVC 2 from the people who helped shape it. Get ready for even more MVC action in this excellent sequel. —Alex Thissen, Killer-Apps Hands-down the best MVC resource available! Written by the industry’s best and it shows…so good you may need to buy two copies. —Andrew Siemer, Software Architect, Lamps Plus Fully explains fundamental MVC concepts and best development practices. —Tetsuo Torigai, Developer, Torigai Consulting This book doesn’t just explain how to use Microsoft’s MVC—it teaches practices that help developers create more maintainable projects. —Anne Epstein, Senior Consultant, Headspring ASP.NET in Action is a must-read for anyone who is serious about developing with the ASP.NET MVC framework. —Steve Michelotti, Microsoft MVP, geekswithblogs.net At merely 300 pages, ASP.NET MVC in Action is a true masterpiece…. The authors are all considered rock stars in the ASP.NET community and they have opened the doors to their concert with ASP.NET MVC in Action. —Mohammad Azam, Microsoft MVP www.it-ebooks.info Praise for Earlier Editions of ASP.NET MVC in Action This book does a good job of not only showing you what to do, it also provides cautionary words to avoid poor practices that may lead to maintenance issues on non-trivial applications. —Venkat Subramanian, NoFluffJustStuff Blogs I really enjoyed ASP.NET MVC in Action and highly recommend it for a fresh look at the ASP.NET MVC framework. —David Hayden, Microsoft MVP ASP.NET MVC in Action will guide you from your first project through advanced topics such as AJAX and deploying on suboptimal hosting environments. The writing style is clear and concise. Diagrams and code examples are abundant. I recommend it for anyone looking for a great resource for learning about or becoming a better user of the ASP.NET MVC framework. —Nathan Stott, Partner and Software Engineer, Whiteboard-IT I’m very happy with this book. I would definitely recommend it to anyone interested in ASP.NET MVC. Getting beyond the text that comes with the CodeCampServer is just icing on the cake. —Chris Stewart, CompiledMonkey.com The authors not only did an excellent job of putting together a great practical guide to ASP.NET MVC, they also successfully embedded some subversive ALT.NET concepts that will make us all better developers. And at the end of the day, that is a damn fine accomplishment! —Bobby Johnson, AppExtremes As my first introduction to MVC, I found this book very readable and interesting. —Roger Wright, Engineering Manager, Aha Macav Power Service www.it-ebooks.info ASP.NET MVC 4 in Action A revised edition of ASP.NET MVC 2 in Action JEFFREY PALERMO, JIMMY BOGARD ERIC HEXTER, MATTHEW HINZE AND JEREMY SKINNER MANNING Shelter Island www.it-ebooks.info For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact Special Sales Department Manning Publications Co. 20 Baldwin Road PO Box 261 Shelter Island, NY 11964 Email: [email protected] ©2012 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without the use of elemental chlorine. Manning Publications Co. Development editor: Cynthia Kane 20 Baldwin Road Technical proofreader: Javier Lozano PO Box 261 Copyeditor: Andy Carroll Shelter Island, NY 11964 Proofreader: Maureen Spencer Cover designer: Marija Tudor Typesetter: Gordan Salinovic ISBN 9781617290411 Printed in the United States of America 1 2 3 4 5 6 7 8 9 10 – MAL – 17 16 15 14 13 12 www.it-ebooks.info brief contents PART 1 HIGH-SPEED FUNDAMENTALS .........................................1 1 ■ Introduction to ASP.NET MVC 3 2 ■ Hello MVC world 12 3 ■ View fundamentals 38 4 ■ Action-packed controllers 59 PART 2 WORKING WITH ASP.NET MVC..................................79 5 ■ View models 81 6 ■ Validation 92 7 ■ Ajax in ASP.NET MVC 104 8 ■ Security 135 9 ■ Controlling URLs with routing 153 10 ■ Model binders and value providers 185 11 ■ Mapping with AutoMapper 197 12 ■ Lightweight controllers 207 13 ■ Organization with areas 220 14 ■ Third-party components 232 15 ■ Data access with NHibernate 244 v www.it-ebooks.info vi BRIEF CONTENTS PART 3 MASTERING ASP.NET MVC ......................................265 16 ■ Extending the controller 267 17 ■ Advanced view techniques 276 18 ■ Dependency injection and extensibility 294 19 ■ Portable areas 311 20 ■ Full system testing 321 21 ■ Hosting ASP.NET MVC applications 339 22 ■ Deployment techniques 365 23 ■ Upgrading to ASP.NET MVC 4 374 24 ■ ASP.NET Web API 385 www.it-ebooks.info contents foreword xv foreword to the second edition xvi foreword to the first edition xvii preface xix acknowledgments xxiii about this book xxvi about the authors xxix about the cover illustration xxxii PART 1 HIGH-SPEED FUNDAMENTALS..............................1 Introduction to ASP.NET MVC 3 1 1.1 Setting the stage 4 The .NET platform 4 ■ ASP.NET Web Forms 5 1.2 What is ASP.NET MVC? 5 The MVC pattern 7 ■ Benefits of ASP.NET MVC 8 1.3 What’s new in ASP.NET MVC 3/4? 8 The Razor view engine 9 ■ Package management with NuGet 9 Improved extensibility 10 ■ Global action filters 10 ■ Dynamic language features 10 ■ Partial page output caching 10 Ajax improvements 10 ■ Validation improvements 10 1.4 Summary 11 vii www.it-ebooks.info viii CONTENTS Hello MVC world 12 2 2.1 Setting up your development environment 13 Installing MVC using the Web Platform Installer 13 2.2 Creating your first MVC application 15 Creating a new project 15 ■ A tour of the default project template 17 Controllers, actions, and displaying dynamic content 19 2.3 The Guestbook sample application 23 Creating the database 23 ■ Adding the model 24 ■ Accepting guestbook entries 28 ■ Displaying guestbook entries 33 Customizing the look and feel with layouts 35 2.4 Summary 37 View fundamentals 38 3 3.1 Introducing views 38 Selecting a view to render 39 ■ Overriding the view name 40 3.2 Passing data to views 40 Examining the ViewDataDictionary 40 ■ The ViewBag 42 Strongly typed views with a view model 43 ■ Displaying view model data in a view 44 3.3 Using strongly typed templates 48 EditorFor and DisplayFor templates 49 ■ Built-in templates 51 Selecting templates 52 ■ Customizing templates 54 3.4 Summary 58 Action-packed controllers 59 4 4.1 Exploring controllers and actions 60 IController and the controller base classes 60 ■ What makes an action method 62 4.2 What should be in an action method? 63 Manually mapping view models 64 ■ Input validation 66 4.3 Introduction to unit testing 69 Using the provided test project 69 ■ Testing the GuestbookController 71 4.4 Summary 77 www.it-ebooks.info CONTENTS ix PART 2 WORKING WITH ASP.NET MVC ......................79 View models 81 5 5.1 What is a view model? 82 The online store example 82 ■ Building the view model 84 Delivering the presentation model 84 ■ ViewData.Model 85 5.2 Representing user input 86 Designing the model 86 ■ Presenting the input model in a view 87 ■ Working with the submitted input 88 5.3 More complex models for both display and input 89 Designing a combined display and input model 90 ■ Working with the input model 90 5.4 Summary 91 Validation 92 6 6.1 Server-side validation 93 Validation with Data Annotations 93 ■ Extending the ModelMetadataProvider 96 6.2 Client-side validation 98 Getting started with client-side validation 99 ■ Using RemoteAttribute 100 ■ Creating custom client-side validators 101 6.3 Summary 103 Ajax in ASP.NET MVC 104 7 7.1 Ajax with jQuery 105 jQuery primer 106 ■ Using jQuery to make Ajax requests 107 Progressive enhancement 109 ■ Using Ajax to submit form data 111 7.2 ASP.NET MVC Ajax helpers 114 Ajax.ActionLink 116 ■ Ajax.BeginForm 117 ■ Ajax options 118 Differences from earlier versions of ASP.NET MVC 119 7.3 Ajax with JSON and client templates 120 Ajax with JSON 120 ■ Client-side templates 124 ■ Finishing touches 126 7.4 Creating an autocomplete text box 129 Building the CitiesController 129 7.5 Summary 134 www.it-ebooks.info x CONTENTS Security 135 8 8.1 Authentication and authorization 136 Restricting access with the AuthorizeAttribute 136 AuthorizeAttribute—how it works 138 8.2 Cross-site scripting (XSS) 140 XSS in action 140 ■ Avoiding XSS vulnerabilities 142 8.3 Cross-site request forgery (XSRF) 145 XSRF in action 146 ■ Preventing XSRF 147
Recommended publications
  • Microsoft Update Blue Screen Error Fixing BSOD
    kyoceradocumentsolutions.us Microsoft Update Blue Screen Error Fixing BSOD March 2021 Microsoft Update Blue Screen Error What is causing the Blue Screen error when I print using the KX Driver? Kyocera as well as many other companies began getting reports of Blue Screen of Death (BSOD) incidents when printing. Microsoft released 2 updates this week, KB5000802 and KB5000808. The updates caused the crash. What has Microsoft done since this was reported? Microsoft has removed both updates from the automatic pushed update list. If your PC has not yet downloaded the update it will not install them. If you manually update your system from within Windows Update the 2 problem updates are still there and can be manually selected and installed. Do not do that until a complete fix is released if your PC is used for printing. Microsoft has left them up for manual install for users that have systems not used for printing. How do we fix a PC that has already been updated? The best solution is to uninstall the 2 Updates. Follow the directions below and remember to reboot when done. 1. Open a Command Prompt with Administrator rights. Click on the Start button and type cmd. The following will be displayed. 2 Microsoft Update Blue Screen Error 2. Click Run as Administrator on the right to open the Command Prompt Window. Accept the prompt to open with elevated rights and make changes to the computer. 3. In the Command Prompt enter the following command and press enter. – wusa /uninstall /kb:5000802 4. The Stand alone install will launch and remove the Update.
    [Show full text]
  • Ironpython in Action
    IronPytho IN ACTION Michael J. Foord Christian Muirhead FOREWORD BY JIM HUGUNIN MANNING IronPython in Action Download at Boykma.Com Licensed to Deborah Christiansen <[email protected]> Download at Boykma.Com Licensed to Deborah Christiansen <[email protected]> IronPython in Action MICHAEL J. FOORD CHRISTIAN MUIRHEAD MANNING Greenwich (74° w. long.) Download at Boykma.Com Licensed to Deborah Christiansen <[email protected]> For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact Special Sales Department Manning Publications Co. Sound View Court 3B fax: (609) 877-8256 Greenwich, CT 06830 email: [email protected] ©2009 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15% recycled and processed without the use of elemental chlorine.
    [Show full text]
  • Introducing Visual Studio 2010
    INTRODUCING VISUAL STUDIO 2010 DAVID CHAPPELL MAY 2010 SPONSORED BY MICROSOFT CONTENTS Tools and Modern Software Development ............................................................................................ 3 Understanding Visual Studio 2010 ........................................................................................................ 3 The Components of Visual Studio 2010 ................................................................................................... 4 A Closer Look at Team Foundation Server............................................................................................... 5 Work Item Tracking ............................................................................................................................. 7 Version Control .................................................................................................................................... 8 Build Management: Team Foundation Build ...................................................................................... 9 Reporting and Dashboards.................................................................................................................. 9 Using Visual Studio 2010 ..................................................................................................................... 12 Managing Requirements ....................................................................................................................... 12 Architecting a Solution .........................................................................................................................
    [Show full text]
  • Automatically Detecting ORM Performance Anti-Patterns on C# Applications Tuba Kaya Master's Thesis 23–09-2015
    Automatically Detecting ORM Performance Anti-Patterns on C# Applications Tuba Kaya Master's Thesis 23–09-2015 Master Software Engineering University of Amsterdam Supervisors: Dr. Raphael Poss (UvA), Dr. Giuseppe Procaccianti (VU), Prof. Dr. Patricia Lago (VU), Dr. Vadim Zaytsev (UvA) i Abstract In today’s world, Object Orientation is adopted for application development, while Relational Database Management Systems (RDBMS) are used as default on the database layer. Unlike the applications, RDBMSs are not object oriented. Object Relational Mapping (ORM) tools have been used extensively in the field to address object-relational impedance mismatch problem between these object oriented applications and relational databases. There is a strong belief in the industry and a few empirical studies which suggest that ORM tools can cause decreases in application performance. In this thesis project ORM performance anti-patterns for C# applications are listed. This list has not been provided by any other study before. Next to that, a design for an ORM tool agnostic framework to automatically detect these anti-patterns on C# applications is presented. An application is developed according to the designed framework. With its implementation of analysis on syntactic and semantic information of C# applications, this application provides a foundation for researchers wishing to work further in this area. ii Acknowledgement I would like to express my gratitude to my supervisor Dr. Raphael Poss for his excellent support through the learning process of this master thesis. Also, I like to thank Dr. Giuseppe Procaccianti and Prof. Patricia Lago for their excellent supervision and for providing me access to the Green Lab at Vrije Universiteit Amsterdam.
    [Show full text]
  • ASP.NET MVC with Entity Framework and CSS
    ASP.NET MVC with Entity Framework and CSS Lee Naylor ASP.NET MVC with Entity Framework and CSS Lee Naylor Newton-le-Willows, Merseyside United Kingdom ISBN-13 (pbk): 978-1-4842-2136-5 ISBN-13 (electronic): 978-1-4842-2137-2 DOI 10.1007/978-1-4842-2137-2 Library of Congress Control Number: 2016952810 Copyright © 2016 by Lee Naylor This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made.
    [Show full text]
  • Open Babel Documentation Release 2.3.1
    Open Babel Documentation Release 2.3.1 Geoffrey R Hutchison Chris Morley Craig James Chris Swain Hans De Winter Tim Vandermeersch Noel M O’Boyle (Ed.) December 05, 2011 Contents 1 Introduction 3 1.1 Goals of the Open Babel project ..................................... 3 1.2 Frequently Asked Questions ....................................... 4 1.3 Thanks .................................................. 7 2 Install Open Babel 9 2.1 Install a binary package ......................................... 9 2.2 Compiling Open Babel .......................................... 9 3 obabel and babel - Convert, Filter and Manipulate Chemical Data 17 3.1 Synopsis ................................................. 17 3.2 Options .................................................. 17 3.3 Examples ................................................. 19 3.4 Differences between babel and obabel .................................. 21 3.5 Format Options .............................................. 22 3.6 Append property values to the title .................................... 22 3.7 Filtering molecules from a multimolecule file .............................. 22 3.8 Substructure and similarity searching .................................. 25 3.9 Sorting molecules ............................................ 25 3.10 Remove duplicate molecules ....................................... 25 3.11 Aliases for chemical groups ....................................... 26 4 The Open Babel GUI 29 4.1 Basic operation .............................................. 29 4.2 Options .................................................
    [Show full text]
  • De La Torre C. Et
    y i EDITION v2.01 DOWNLOAD available at: https://aka.ms/microservicesebook PUBLISHED BY Microsoft Developer Division, .NET and Visual Studio product teams A division of Microsoft Corporation One Microsoft Way Redmond, Washington 98052-6399 Copyright © 2017 by Microsoft Corporation All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher. This book is provided “as-is” and expresses the author’s views and opinions. The views, opinions and information expressed in this book, including URL and other Internet website references, may change without notice. Some examples depicted herein are provided for illustration only and are fictitious. No real association or connection is intended or should be inferred. Microsoft and the trademarks listed at http://www.microsoft.com on the “Trademarks” webpage are trademarks of the Microsoft group of companies. Mac and macOS are trademarks of Apple Inc. The Docker whale logo is a registered trademark of Docker, Inc. Used by permission. All other marks and logos are property of their respective owners. Co-Authors: Editors: Cesar de la Torre, Sr. PM, .NET product team, Microsoft Corp. Mike Pope Bill Wagner, Sr. Content Developer, C+E, Microsoft Corp. Steve Hoag Mike Rousos, Principal Software Engineer, DevDiv CAT team, Microsoft Participants and reviewers: Jeffrey Ritcher, Partner Software Eng, Azure team, Microsoft Dylan Reisenberger, Architect and Dev Lead at Polly Jimmy Bogard, Chief Architect at Headspring Steve Smith, Software Craftsman & Trainer at ASPSmith Ltd. Udi Dahan, Founder & CEO, Particular Software Ian Cooper, Coding Architect at Brighter Jimmy Nilsson, Co-founder and CEO of Factor10 Unai Zorrilla, Architect and Dev Lead at Plain Concepts Glenn Condron, Sr.
    [Show full text]
  • Best Recommended Visual Studio Extensions
    Best Recommended Visual Studio Extensions Windowless Agustin enthronizes her cascade so especially that Wilt outstretch very playfully. If necessary or unfooled August usually supple his spruces outhits indissolubly or freest enforcedly and centesimally, how dramaturgic is Rudolph? Delbert crepitated racially. You will reformat your best visual studio extensions quickly open a bit is a development in using frequently used by the references to build crud rest client certifications, stocke quelle mise en collectant et en nuestras páginas Used by Automattic for internal metrics for user activity, nice and large monitors. The focus of this extension is to keep the code dry, and UWP apps. To visual studio extensibility with other operating systems much more readable and let you recommended by agreeing you have gained popularity, make this is through git. How many do, i want it more information and press j to best recommended visual studio extensions installed too would be accessed by the best programming tips and accessible from. If, and always has been an independent body. Unity Snippets is another very capable snippet extension for Unity Developers. Code extension very popular programming language or visual studio extensibility interfaces. The best extensions based on your own dsl model behind this, but using the highlighted in. If you recommended completion. The recommended content network tool for best recommended visual studio extensions out of the method. This can prolong the times it takes to load a project. The best of vs code again after you with vs code is the basics and. Just a custom bracket characters that best recommended visual studio extensions? Extensions i though git projects visual studio is there are mostly coherent ramblings of the latest icon.
    [Show full text]
  • Sams Teach Yourself Javascript in 24 Hours
    Phil Ballard Michael Moncur SamsTeachYourself JavaScript™ Fifth Edition in Hours24 800 East 96th Street, Indianapolis, Indiana, 46240 USA Sams Teach Yourself JavaScript™ in 24 Hours, Fifth Edition Editor-in-Chief Mark Taub Copyright © 2013 by Pearson Education, Inc. All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, Acquisitions Editor or transmitted by any means, electronic, mechanical, photocopying, recording, or other- Mark Taber wise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has Managing Editor been taken in the preparation of this book, the publisher and author assume no responsi- Kristy Hart bility for errors or omissions. Nor is any liability assumed for damages resulting from the use of the information contained herein. Project Editor ISBN-13: 978-0-672-33608-9 Anne Goebel ISBN-10: 0-672-33608-1 Copy Editor Library of Congress Cataloging-in-Publication Data is on file. Geneil Breeze Printed in the United States of America First Printing October 2012 Indexer Erika Millen Trademarks All terms mentioned in this book that are known to be trademarks or service marks have Proofreader been appropriately capitalized. Sams Publishing cannot attest to the accuracy of this Chrissy White, information. Use of a term in this book should not be regarded as affecting the validity of Language Logistics any trademark or service mark. Publishing Coordinator Warning and Disclaimer Vanessa Evans Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied.
    [Show full text]
  • Release 1.13 Kal Ahmed, Graham Moore
    BrightstarDB Documentation Release 1.13 Kal Ahmed, Graham Moore January 08, 2016 Contents 1 Getting Started 1 1.1 Architect.................................................1 1.2 Data....................................................1 1.3 Developer.................................................1 2 Concepts 3 2.1 Architecture...............................................3 2.2 Data Model................................................4 2.3 Storage Features.............................................5 2.4 Client APIs................................................5 2.5 Supported RDF Syntaxes........................................5 3 Why BrightstarDB? 7 3.1 An Associative Model..........................................7 3.2 Schema-less Data Store.........................................7 3.3 A Semantic Data Model.........................................7 3.4 Automatic Data caching.........................................8 3.5 Full Historical Capabilities........................................8 3.6 Developer Friendly Toolset.......................................8 3.7 Native .NET Semantic Web Database..................................8 3.8 RDF is great for powering Object Oriented solutions..........................8 4 Developing With BrightstarDB9 5 Developer Quick Start 11 5.1 Create New Project............................................ 11 5.2 Create the Model............................................. 12 5.3 Generating the Context and Classes................................... 13 5.4 Using the Context...........................................
    [Show full text]
  • Wavefront Engineering for Manipulating Light-Atom Interactions
    WAVEFRONT ENGINEERING FOR MANIPULATING LIGHT-ATOM INTERACTIONS YEO XI JIE A0140239M [email protected] Report submitted to Department of Physics, National University of Singapore in partial fulfilment for the module PC3288/PC3289 Advanced UROPS in Physics I/II November 2017 Contents 1 Manipulations of Wavefronts 5 1.1 Motivations . 5 1.2 The Spatial Light Modulator (SLM) . 5 1.3 Controlling the SLM . 8 1.3.1 The Meadowlark XY Series SLM (P512L) . 8 1.3.2 Basic Concepts . 10 1.3.3 Display Configurations . 10 1.3.4 Controlling Phase Shifts with an Image . 10 2 Simple Applications of the SLM 15 2.1 Characterising Phase Shifts of the SLM . 15 2.1.1 Background of Experiment . 15 2.1.2 Implementation . 16 2.2 Beam Displacement by Blazed Grating . 20 2.3 Beam Position Measurements . 24 2.3.1 Method A: Using the birefringence of the SLM . 24 2.3.2 Method B: Fashioning the SLM as a Knife Edge . 26 2.4 Creating Laguerre-Gaussian Mode Beams . 29 3 Measuring Wavefronts 33 1 3.1 Hartmann-Shack Wavefront Sensor . 33 3.1.1 How it Works . 34 3.1.2 A Note on the Lenslet Array . 35 3.2 Zernike Modes . 36 4 Effect of Wavefront Corrections on Fiber Coupling 38 5 Conclusion 44 5.1 Future Outlook . 44 2 Acknowledgements First, I would like to thank Christian Kurtsiefer for giving me the opportunity to work in his group for this project. I would also like to thank everyone in the Quantum Optics group for making my journey through the project enriching and enjoyable, and for the technical help all of you have provided in the lab.
    [Show full text]
  • Javascript & AJAX
    JavaScript & AJAX JavaScript had to “look like Java” only less so—be Java's dumb kid brother or boy-hostage sidekick. Plus, I had to be done in ten days or something worse than JavaScript would have happened. JavaScript: the Big Picture(ELLS §11.1) © 2012 Armando Fox & David Patterson Licensed under Creative Commons Attribution- Image: Wikimedia. Used under CC-SA license. NonCommercial-ShareAlike 3.0 Unported License The Moving Parts • 1995: Netscape includes LiveScript JavaScript as browser scripting language • Originally, for simple client-side code such as animations and form input validation • Document Object Model (DOM) lets JavaScript inspect & modify document elements • 1997: standardized as ECMAScript • 1998: Microsoft adds XmlHttpRequest to IE5 • 2005: Google Maps, AJAX takes off JavaScript’s privileged position • Because it’s embedded in browser, JavaScript code can: 1. be triggered by user-initiated events (mouse down, mouse hover, keypress, …) 2. make HTTP requests to server without triggering page reload 3. be triggered by network events (e.g. server responds to HTTP request) 4. examine & modify (causing redisplay) current document DOM & JavaScript: Document = tree of objects • DOM is a language-independent, hierarchical representation of HTML or XML document • Browser parses HTML or XML => DOM • JavaScript API (JSAPI) makes DOM data structures accessible from JS code • Inspect DOM element values/attributes • Change values/attributes → redisplay • Implemented incompatibly across browsers …but jQuery framework will help us
    [Show full text]