Advanced Programming for the Java(TM) 2 Platform

Total Page:16

File Type:pdf, Size:1020Kb

Advanced Programming for the Java(TM) 2 Platform Advanced Programming for the Java(TM) 2 Platform Training Index Advanced Programming for the JavaTM 2 Platform By Calvin Austin and Monica Pawlan November 1999 [CONTENTS] [NEXT>>] [DOWNLOAD] Requires login As an experienced developer on the JavaTM platform, you undoubtedly know how fast moving and comprehensive the Early Access platform is. Its many application programming interfaces (APIs) Downloads provide a wealth of functionality for all aspects of application and system-level programming. Real-world developers never use one Bug Database or two APIs to solve a problem, but bring together key Submit a Bug functionality spanning a number of APIs. Knowing which APIs you View Database need, which parts of which APIs you need, and how the APIs work together to create the best solution can be a daunting task. Newsletters Back Issues To help you navigate the Java APIs and fast-track your project Subscribe development time, this book includes the design, development, test, and deployment phases for an enterprise-worthy auction Learning Centers application. While the example application does not cover every Articles possible programming scenario, it explores many common Bookshelf situations and the discussions leave you with a solid methodology Code Samples for designing and building your own solutions. New to Java Question of the Week This book is for developers with more than a beginning level of Quizzes understanding of writing programs in the Java programming Tech Tips language. The example application is written with the Java® 2 Tutorials platform APIs and explained in terms of functional hows and whys, so if you need help installing the Java platform, setting up your Forums environment, or getting your first application to work, you should first read a more introductory book such as Essentials of the Java Programming Language: A Hands-On Guide or The Java Tutorial. http://developer.java.sun.com/developer/onlineTraining/Programming/JDCBook/ (1 of 4) [2001-6-13 8:07:37] Advanced Programming for the Java(TM) 2 Platform Technology Centers Note: This tutorial is available as a book from online book sellers Also, send your comments and thoughts to [email protected] Contents Chapter 1: Matching Project Requirements with Technology ● Project Requirements ● Choosing the Software Chapter 2: Auction House Application ● A Multi-Tiered Application with Enterprise Beans ● Entity and Session Beans ● Examining a Container-Managed Bean ● Container-Managed finder Methods Chapter 3: Data and Transaction Management ● Bean-Managed Persistence and the JDBCTM Platform ● Managing Transactions ● Bean-Managed finder Methods Chapter 4: Distributed Computing ● Lookup Services ● Remote Method Invocation (RMI) ● Common Object Request Broker Architecture (CORBA) ● JDBCTM Technology ● Servlets Chapter 5: Java Native Interface (JNI) Technology ● JNI Example ● Strings and Arrays http://developer.java.sun.com/developer/onlineTraining/Programming/JDCBook/ (2 of 4) [2001-6-13 8:07:37] Advanced Programming for the Java(TM) 2 Platform ● Other Programming Issues Chapter 6. Project Swing: Building a User Interface ● Components and Data Models ● Printing API ● Advanced Printing Chapter 7: Debugging Applets, Applications, and Servlets ● Collecting Evidence ● Running Tests and Analyzing ● Servlet Debugging ● AWT Event Debugging ● Analyzing Stack Traces ● Version Issues Chapter 8: Performance Techniques ● Improving Performance by Design ● Connection Pooling ● Performance Features and Tools ● Performance Analysis ● Caching Client/Server Applications Chapter 9: Deploying the Auction Application ● Java Archive File Format ● SolarisTM Platform ● Win32 Platform Chapter 10: More Security Topics ● Signed Applets ● Writing a Security Manager Appendix A: Security and Permissions Appendix B: Classes, Methods, and Permissions Appendix C: SecurityManager Methods Epilogue Acknowledgements http://developer.java.sun.com/developer/onlineTraining/Programming/JDCBook/ (3 of 4) [2001-6-13 8:07:37] Advanced Programming for the Java(TM) 2 Platform Special thanks to experts Isaac Elias, Daniel Liu, and Mark Horwath for their contributions to the advanced examples in the book. Reader Feedback Tell us what you think of this book. [TOP] [ This page was updated: 4-Jun-2001 ] Products & APIs | Developer Connection | Docs & Training | Online Support Community Discussion | Industry News | Solutions Marketplace | Case Studies Glossary | Feedback | A-Z Index For more information on Java technology and other software from Sun Microsystems, call: (800) 786-7638 Copyright © 1995-2001 Sun Microsystems, Inc. Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first. All Rights Reserved. Terms of Use. Privacy Policy. http://developer.java.sun.com/developer/onlineTraining/Programming/JDCBook/ (4 of 4) [2001-6-13 8:07:37] Writing Advanced Applications, Chapter 1: Matching Project Requirements with Technology Training Index Writing Advanced Applications Chapter 1: Matching Project Requirements with Technology [<<BACK] [CONTENTS] [NEXT>>] One challenge in writing a book on advanced application development for the JavaTM platform is to find a project small enough to write about, while at the same time, complex enough to warrant advanced programming techniques. Requires login The project presented in this book is a web-based auction house. The application is initially written for the Enterprise JavaBeansTM Early Access platform. Later chapters expand the core example described here Downloads by adding advanced functionality, improvements, and alternative solutions to do some of the things you get for free when you use Bug Database the Enterprise JavaBeans platform. Submit a Bug View Database To keep the discussion simple, the example application has only a basic set of transactions for posting and bidding on auction items. Newsletters However, the application scales to handle multiple users, provides Back Issues a three-tiered transaction-based environment, controls security, Subscribe and integrates legacy-based systems. This chapter covers how to determine project requirements and model the Learning Centers application—important steps that should always come before Articles coding begins. Bookshelf Code Samples ● Project Requirements and Modeling New to Java ● Choosing the Software Question of the Week Quizzes Tech Tips In a Rush? Tutorials This table links you directly to specific topics. Forums Topic Section Auction Demonstration Duke's Auction http://developer.java.sun.com/developer/onlineTraining/Programming/JDCBook/proj.html (1 of 2) [2001-6-13 8:07:50] Writing Advanced Applications, Chapter 1: Matching Project Requirements with Technology Technology Centers Project Requirements Interview User Base Model the Project Modeling House Identifies Buyers and Sellers House Determines Highest Bidder House Notifies Buyers and Sellers Anyone Searches for an Item Anyone Views Items for Sale Anyone Views Item Details Seller Posts Items for Sale Buyer Bids on Items Activity Diagram Choosing Software JavaTM APIs [TOP] [ This page was updated: 4-Jun-2001 ] Products & APIs | Developer Connection | Docs & Training | Online Support Community Discussion | Industry News | Solutions Marketplace | Case Studies Glossary | Feedback | A-Z Index For more information on Java technology and other software from Sun Microsystems, call: (800) 786-7638 Copyright © 1995-2001 Sun Microsystems, Inc. Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first. All Rights Reserved. Terms of Use. Privacy Policy. http://developer.java.sun.com/developer/onlineTraining/Programming/JDCBook/proj.html (2 of 2) [2001-6-13 8:07:50] Writing Advanced Applications, Chapter 1: Project Requirements and Modeling Training Index Writing Advanced Applications Chapter 1 Continued: Project Requirements and Modeling [<<BACK] [CONTENTS] [NEXT>>] The first step in determining project requirements is to interview the user base to find out what they want in an online auction. This is an important step, and one that cannot be overrated because a solid base of user-oriented information helps you define your key application capabilities. Requires login Chapter 2 walks through the application code, explains how the Early Access Enterprise JavaBeans platform works, and tells you how to run a Downloads live demonstration. If you have never seen or used an online auction, here are mockups of the example auction application HTML Bug Database pages. Submit a Bug View Database ● Interview User Base ● Model the Project Newsletters Back Issues Subscribe Interview User Base Learning Centers For the sake of discussion and to keep things simple, this Articles discussion assumes interviews with the user base found auction Bookshelf house and user requirements, as follows: Code Samples New to Java Auction House Requirements Question of the Week Quizzes ● Require buyer and seller information Tech Tips ● Bill sellers for posting items Tutorials ● Record and report the day's transactions User Requirements Forums ● Bid on or sell an item ● Search or view items for sale ● Notify buyer and seller of sale Model the Project http://developer.java.sun.com/developer/onlineTraining/Programming/JDCBook/proj2.html (1 of 6) [2001-6-13 8:08:07] Writing Advanced Applications, Chapter 1: Project Requirements and Modeling Technology Centers After analyzing the requirements, you can build a use case diagram for the application to gain a better understanding of the elements needed in the application and how they interact. A use case diagram shows the relationships
Recommended publications
  • How Can Java Class Files Be Decompiled?
    HOW CAN JAVA CLASS FILES BE DECOMPILED? David Foster Chamblee High School 11th Grade Many computer science courses feature building a compiler as a final project. I have decided to take a spin on the idea and instead develop a decompiler. Specifically, I decided to write a Java decompiler because: one, I am already familiar with the Java language, two, the language syntax does not suffer from feature-bloat, and three, there do not appear to be many Java decompilers currently on the market. I have approached the task of writing a decompiler as a matter of translating between two different languages. In our case, the source language is Java Virtual Machine (VM) Bytecode, and the target language is the Java Language. As such, our decompiler will attempt to analyze the semantics of the bytecode and convert it into Java source code that has equivalent semantics. A nice sideeffect of this approach is that our decompiler will not be dependent upon the syntax of the bytecodes, the compiler used to generate the bytecodes, or the source language (possibly not Java). It will only care whether a class-file’s semantics can be represented in the Java language. Decompilation is divided up into six phases: 1. Read opcodes 2. Interpret opcode behavior 3. Identify Java-language “idioms” 4. Identify patterns of control-flow 5. Generate Java-language statements 6. Format and output to file The first four phases will be discussed in detail within this paper, as they were the primary focus of my research. Further details pertaining to these phases can be gleaned from the accompanying log book.
    [Show full text]
  • Information Retrieval from Java Archive Format
    Eötvös Loránd University Faculty of Informatics Department of Programming Languages and Compilers Information retrieval from Java archive format Supervisor: Author: Dr. Zoltán Porkoláb Bálint Kiss Associate Professor Computer Science MSc Budapest, 2017 Abstract During the course of my work, I contributed to CodeCompass, an open source code comprehension tool made for making codebase of software projects written in C, C++ and Java more understandable through navigation and visualization. I was tasked with the development of a module for recovering code information of Java classes in JAR files. This document details background concepts required for reverse- engineering Java bytecode, creating a prototype JAR file reader and how this solu- tion could be integrated to CodeCompass. First, I studied the structure of JAR format and how class files are stored in it. I looked into the Java Class file structure and how bytecode contained in class gets interpreted by the Java Virtual Machine. I also looked at existing decompilers and what bytecode libraries are. I created a proof-of-concept prototype that reads compiled classes from JAR file and extracts code information. I first showcased the use of Java Reflection API, then the use of Apache Commons Byte Code Engineering Library, a third-party bytecode library used for extracting and representing parts of Java class file as Java objects. Finally, I examined how CodeCompass works, how part of the prototype could be integrated into it and demonstrated the integration through parsing of a simple JAR file. i Acknowledgements I would like to thank Dr. Zoltán Porkoláb, Associate Professor of the Department of Programming Languages and Compilers at the Faculty of Informatics for admit- ting me to the CodeCompass project, supplying the thesis topic and helping with the documentation.
    [Show full text]
  • Sun Ultratm 2 Workstation Just the Facts
    Sun UltraTM 2 Workstation Just the Facts Copyrights 1999 Sun Microsystems, Inc. All Rights Reserved. Sun, Sun Microsystems, the Sun Logo, Ultra, SunFastEthernet, Sun Enterprise, TurboGX, TurboGXplus, Solaris, VIS, SunATM, SunCD, XIL, XGL, Java, Java 3D, JDK, S24, OpenWindows, Sun StorEdge, SunISDN, SunSwift, SunTRI/S, SunHSI/S, SunFastEthernet, SunFDDI, SunPC, NFS, SunVideo, SunButtons SunDials, UltraServer, IPX, IPC, SLC, ELC, Sun-3, Sun386i, SunSpectrum, SunSpectrum Platinum, SunSpectrum Gold, SunSpectrum Silver, SunSpectrum Bronze, SunVIP, SunSolve, and SunSolve EarlyNotifier are trademarks, registered trademarks, or service marks of Sun Microsystems, Inc. in the United States and other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the United States and other countries. Products bearing SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc. OpenGL is a registered trademark of Silicon Graphics, Inc. UNIX is a registered trademark in the United States and other countries, exclusively licensed through X/Open Company, Ltd. Display PostScript and PostScript are trademarks of Adobe Systems, Incorporated. DLT is claimed as a trademark of Quantum Corporation in the United States and other countries. Just the Facts May 1999 Sun Ultra 2 Workstation Figure 1. The Sun UltraTM 2 workstation Sun Ultra 2 Workstation Scalable Computing Power for the Desktop Sun UltraTM 2 workstations are designed for the technical users who require high performance and multiprocessing (MP) capability. The Sun UltraTM 2 desktop series combines the power of multiprocessing with high-bandwidth networking, high-performance graphics, and exceptional application performance in a compact desktop package. Users of MP-ready and multithreaded applications will benefit greatly from the performance of the Sun Ultra 2 dual-processor capability.
    [Show full text]
  • Connecting the Storage System to the Solaris Host
    Configuration Guide for Solaris™ Host Attachment Hitachi Virtual Storage Platform Hitachi Universal Storage Platform V/VM FASTFIND LINKS Document Organization Product Version Getting Help Contents MK-96RD632-05 Copyright © 2010 Hitachi, Ltd., all rights reserved. No part of this publication may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying and recording, or stored in a database or retrieval system for any purpose without the express written permission of Hitachi, Ltd. (hereinafter referred to as “Hitachi”) and Hitachi Data Systems Corporation (hereinafter referred to as “Hitachi Data Systems”). Hitachi Data Systems reserves the right to make changes to this document at any time without notice and assumes no responsibility for its use. This document contains the most current information available at the time of publication. When new and/or revised information becomes available, this entire document will be updated and distributed to all registered users. All of the features described in this document may not be currently available. Refer to the most recent product announcement or contact your local Hitachi Data Systems sales office for information about feature and product availability. Notice: Hitachi Data Systems products and services can be ordered only under the terms and conditions of the applicable Hitachi Data Systems agreement(s). The use of Hitachi Data Systems products is governed by the terms of your agreement(s) with Hitachi Data Systems. Hitachi is a registered trademark of Hitachi, Ltd. in the United States and other countries. Hitachi Data Systems is a registered trademark and service mark of Hitachi, Ltd.
    [Show full text]
  • Practical-Electronic
    EVERYDAY DECEMBER 1997 ELECTRON http://www.epemag.wimborne.co.uk £2.65 pa; cinE, GIANT PULL•OUT , • • «Mr am, - DettgeR:)t tam 4"- ACTIVE , •• MICROPHONE • A simple circuit to increase sensitivity P. rs .• • • - - MINI - •• - • L. tr. ORGAN 1:7 \ An unusual, inexpensive •P 7 " • e design t Ort 9. SA 11 '7 • SOUND rtr1 1 Alarm deterrent for P1R securit hts TEACH-IN 98 ........ Part 2: Capacitors and Inductors Index for Volume 26 THE Noil MAGAZINE FO. ELL TECHNOLOGY- r ra spedal ALTERNATIVE _.•ii 9 770262 361089 Feat and FUTURE TECHNOLOGIES ELECTRIC MAN PLANS, SHOCK PEOPLE WITH THE TOUCH OF YOUR HAND! E5/set Ref F/EMA1 PARABOLIC DISH MICROPHONE PLANS Listen to distant sounds and voices open windows sound sources in 'hard to ger or hostile premises Uses Satellite technology to gather distant sounds and focus them to our ultra sensitive electronics Plans also Sn0,11 xn optional wireless link system £8/set ref F/PM5 2 FOR 1 MULTIFUNCTIONAL HIGH FREQUENCY AND HIGH DC VOLTAGE, SOLID STATE TESLA COIL A AND VARIABLE 100,000 VDC OUTPUT GENERATOR PLANS Operates on 9-12v0c, many possible experiments £10 Ref WIND GENERATORS 380 WATT 1 14 metre rta cades aaroon riatri cades .a year warranty vdc output 24v version available control electronics included brushless neodymium cubic curve alternator only two moving pans maintenance free simple roof top installation start up speed 7mph max output (30mph) 380w £499 ref AIR1 PLANS PORTABLE X RAY MACHINE PLANS Easy to construct e e- plans on a simple and cheap way to build a home X-ray rnachinei Effective device X-ray sealed assemblies can beused for experimental purposes Not a toy or for minors' £6,/set Ref F/XP I TELEKINETIC ENHÀNCER PLANS Mystrfy and amaze your COLOUR CCTV friends by creating motion with no known apparent means or cause Uses no electnca Ior mechanical connections no special gimmicks yet produces positive motion and effect Excellent for science projects.
    [Show full text]
  • Powerkap - a Tool for Improving Energy Transparency for Software Developers on GNU/Linux (X86) Platforms
    Project Report Department of Computing Imperial College of Science, Technology and Medicine PowerKap - A tool for Improving Energy Transparency for Software Developers on GNU/Linux (x86) platforms Author: Supervisor: Krish De Souza Dr. Anandha Gopalan Submitted in partial fulfilment of the requirements for the M.Eng Computing 4 of Imperial College London Contents 1 Introduction 6 1.1 Motivation . .6 1.2 Objectives . .7 1.3 Achievements . .7 2 Background 9 2.1 The relationship between power and energy. .9 2.2 Power controls on x86 platforms . .9 2.3 Improving software for power efficiency . 10 2.3.1 Algorithm . 10 2.3.2 Multithreading . 10 2.3.3 Vectorisation . 10 2.3.4 Improper sleep loops . 12 2.3.5 OS Timers . 13 2.3.6 Context aware programming . 13 2.4 Current methods of monitoring energy. 14 2.4.1 Out of Band Energy Monitor . 14 2.4.2 In-Band Energy Monitor . 14 2.4.2.1 Powertop . 15 2.4.2.2 Turbostat . 16 2.5 Related Work . 16 2.5.1 ENTRA 2012-2015 . 16 2.5.1.1 Common Assertion Language . 16 2.5.1.2 Compiler Optimisation and Power Trade-offs . 18 2.5.1.3 Superoptimization . 18 2.5.1.4 Thermal trade-off . 20 2.5.2 eProf . 20 2.5.2.1 Asynchronous vs Synchronous . 20 2.5.2.2 Profiling implementation . 21 2.5.3 Energy Formal Definitions . 21 2.5.3.1 Java Based Energy Formalism . 22 2.5.3.2 Energy Application Model . 22 2.5.4 Impact of language, Compiler, Optimisations .
    [Show full text]
  • Sun-4 Handbook - Home Page
    Sun-4 Handbook - Home Page Sun Internal ONLY !! The Sun-4 Handbook describes and illustrates the Sun-4 and Sun-4e products for service providers who service these products after the End of Support Life in April 1997. End of Support Life is the end of Sun's commitment to support the product. Sun may help customers locate alternative sources for support on a case-by-case basis if ongoing support is needed beyond 5 years. Spares availability after End of Support Life may be limited and repair service will be at Sun's discretion. http://lios.apana.org.au/~cdewick/sunshack/data/feh/1.4/wcd00000/wcd00036.htm (1 von 2) [25.04.2002 15:56:23] Sun-4 Handbook - Home Page [ Configurations ] [ CPU ] [ Memory ] [ Graphics ] [ IPI ] [ SCSI ] [ SCSI Disk ] [ Removable Media ] [ Communication ] [ Miscellaneous ] [ Backplane ] [ Slot Assignment ] [ Parts Introduction ] [ System ] [ Disk Options ] [ Removable Media Options ] [ Miscellaneous Options ] [ Board ] [ Input Device ] [ Monitor ] [ Printer ] [ CPU Trouble ] [ Disk Trouble ] [ Diagnostics ] [ Power Introduction ] [ AC Power ] [ DC Power ] The original hardcopy publication of the Sun-4 Handbook is part number 805-3028-01. © 1987-1999, Sun Microsystems Inc. http://lios.apana.org.au/~cdewick/sunshack/data/feh/1.4/wcd00000/wcd00036.htm (2 von 2) [25.04.2002 15:56:23] Sun4/II: DC Power - Contents DC Power Power Supplies 300-1020 -- Brown -- 575 Watts 300-1020 -- Fuji -- 575 Watts 300-1022 -- Summit -- 325 Watts 300-1022 -- Brown -- 325 Watts 300-1024 -- Fuji -- 850 Watts 300-1031 -- Delta -- 120 Watts
    [Show full text]
  • Java Class Annotation Example
    Java Class Annotation Example Bud etherealizing her matriarch inimitably, unwavering and decayed. Antimonious and regulation Rog violated almost anywhere, though Saunderson tosses his Creon outdating. Which Roland disinhuming so ordinarily that Westleigh tooth her opposites? It is class to classes are pretty easy to reflection to list to catch, company or property to generate mock for? First method of java example. The java are given list of bibliography. Default annotations example, java code examples of the compiler to be applied to json. The new project for extracting information to create web sites without editions but i go into the annotated bibliography paper, we welcome to isolate the mechanics of using. Parsing the examples can be used from open source and. We will utilize the class analyzes the same type declaration etc at runtime reflection methods or evaluative lists the suite itself which are. Nice explanation about the front controller, we added and then issues a class of the information, management example demonstrates how can be executed and. There are working standalone spring boot application into system proposed here, because of annotations. Its annotations example annotation examples java. Hibernate does not to class or specify java example of fundamental never hurt or not. Read from java class acts as each article has been designed with examples select then we learned about? We made as classes that class or examples of annotation example classes or an earlier article example it tells spring. The table pointing back to interface. From java example is applied only contains a second argument. Junit provides a test cases, we want specific warnings and ideas into our newsletter for an understanding takt time in.
    [Show full text]
  • Java and C I CSE 351 Autumn 2016
    L26: JVM CSE351, Spring 2018 Java Virtual Machine CSE 351 Spring 2018 Model of a Computer “Showing the Weather” Pencil and Crayon on Paper Matai Feldacker-Grossman, Age 4 May 22, 2018 L26: JVM CSE351, Spring 2018 Roadmap C: Java: Memory & data Integers & floats car *c = malloc(sizeof(car)); Car c = new Car(); x86 assembly c->miles = 100; c.setMiles(100); c->gals = 17; c.setGals(17); Procedures & stacks float mpg = get_mpg(c); float mpg = Executables free(c); c.getMPG(); Arrays & structs Memory & caches Assembly get_mpg: Processes language: pushq %rbp Virtual memory movq %rsp, %rbp ... Memory allocation popq %rbp Java vs. C ret OS: Machine 0111010000011000 code: 100011010000010000000010 1000100111000010 110000011111101000011111 Computer system: 2 L26: JVM CSE351, Spring 2018 Implementing Programming Languages Many choices in how to implement programming models We’ve talked about compilation, can also interpret Interpreting languages has a long history . Lisp, an early programming language, was interpreted Interpreters are still in common use: . Python, Javascript, Ruby, Matlab, PHP, Perl, … Interpreter Your source code implementation Your source code Binary executable Interpreter binary Hardware Hardware 3 L26: JVM CSE351, Spring 2018 An Interpreter is a Program Execute (something close to) the source code directly Simpler/no compiler – less translation More transparent to debug – less translation Easier to run on different architectures – runs in a simulated environment that exists only inside the interpreter process . Just port the interpreter (program), not the program-intepreted Slower and harder to optimize 4 L26: JVM CSE351, Spring 2018 Interpreter vs. Compiler An aspect of a language implementation . A language can have multiple implementations . Some might be compilers and other interpreters “Compiled languages” vs.
    [Show full text]
  • Hibernate Tools
    APPENDIX A ■ ■ ■ More Advanced Features In this appendix, we discuss some of the features that, strictly speaking, lie outside the scope of this book, but that you should be aware of if you go on to use Hibernate in more depth. Managed Versioning and Optimistic Locking While we have saved versioning for this appendix’s discussion of advanced features, it is actually quite straightforward to understand and apply. Consider the following scenario: • Client A loads and edits a record. • Client B loads and edits the same record. • Client A commits its edited record data. • Client B commits its differently edited record data. While the scenario is simple, the problems it presents are not. If Client A establishes a transaction, then Client B may not be able to load and edit the same record. Yet in a web environment, it is not unlikely that Client A will close a browser window on the open record, never committing or canceling the transaction, so that the record remains locked until the session times out. Clearly this is not a satisfactory solution. Usually, you will not want to permit the alternative scenario, in which no locking is used, and the last person to save a record wins! The solution, versioning, is essentially a type of optimistic locking (see Chapter 8). When any changes to an entity are stored, a version column is updated to reflect the fact that the entity has changed. When a subsequent user tries to commit changes to the same entity, the original version number will be compared against the current value—if they differ, the commit will be rejected.
    [Show full text]
  • Installing Python, Pygame, and Visual Studio Code
    Set up Python and Visual Studio Code: Macs Installing Python, Pygame, and Visual Studio Code To provide more flexibility, capability, and better tools for editing and debugging your code we are going to set up our computers with software for developing Python applications, Python games, and Web sites. Python 3 Installation (includes IDLE and Pip) • This will install the following software: o Python 3 Programming language and Interpreter o IDLE: an integrated development environment for Python o Pip: Python package installer • We want to use Python 3. Although Python is already installed on most Macs, it may be Python 2, or maybe an older version of Python 3. We need to leave Python 2 alone as your Mac may need it for some apps. We will install the latest version of Python 3. • Check your version of MacOS (Apple icon: About this Mac); the latest Python 3 requires version 10.9 or higher • Check your versions of Python: o Open terminal from the dock or command-space and type “Terminal” o In terminal type ‘python —version’ to see the version of Python 2 o In terminal type ‘python3 —version’ to see the version of Python3 • Go to https://www.python.org/downloads/ • The site detects whether you are on Windows or Mac and presents a download button for the latest version for your operating system. Click the “Download Python 3.8.1” button (or whatever is current version…) • Install by clicking Downloads from the dock or Finder, then click python-3-8-1- macosx-10.9.pkg to bring up the installer © Fox1 Valley Girls Coding Club Setup Python and Visual Studio Code: Windows • Follow the steps in the installer.
    [Show full text]
  • Using Other Tools with Jython
    A P P E N D I X A Using Other Tools with Jython The primary focus of this appendix is to provide information on using some external Python packages with Jython, as well as providing information regarding the Jython registry. In some circumstances, the tools must be used or installed a bit differently on Jython than on CPython, and those differences will be noted. Because there is a good deal of documentation on the usage of these tools available on the web, this appendix will focus on using the tool specifically with Jython. However, relevant URLs will be cited for finding more documentation on each of the topics. The Jython Registry Because there is no good platform-independent equivalent of the Windows Registry or Unix environment variables, Java has its own environment variable namespace. Jython acquires its namespace from the following sources (later sources override defaults found in earlier places): • The Java system properties, typically passed in on the command line as options to the java interpreter. • The Jython “registry” file, containing prop=value pairs. Read on for the algorithm Jython uses to find the registry file. • The user’s personal registry file, containing similarly formatted prop/value pairs. The user’s registry file can be found at "user.home"+"/.jython" • Jython properties specified on the command line as options to the Jython class. See the -D option to the interpreter. Registry Properties The following properties are recognized by Jython. There may be others that aren’t documented here; consult the comments in registry file for details. python.cachedir The directory to use for caches—currently just package information.
    [Show full text]