The Programming Historian

Total Page:16

File Type:pdf, Size:1020Kb

The Programming Historian The Programming Historian The Programming Historian is an open-access introduction to programming in Python, aimed at working historians (and other humanists) with little previous experience. There are two editions available here; the second is currently under development. We are constantly adding new material, much of it driven by reader request. We welcome questions, corrections and suggestions for improvement. At this point we are still figuring out how best to allow community participation, while maintaining the coherence and direction of a more monographic work. If you e-mail us at [email protected], [email protected] and/or [email protected], we are happy to respond to you personally and try to incorporate your comments. In the future we may come up with something more elegant... but, hey, it's a work in progress. • William J. Turkel, Adam Crymble and Alan MacEachern, The Programming Historian, 2nd ed. NiCHE: Network in Canadian History & Environment (2009-). • William J. Turkel and Alan MacEachern, The Programming Historian, 1st ed. NiCHE: Network in Canadian History & Environment (2007-08). Introductory lessons teach you how to • install Zotero, the Python programming language and other useful tools • read and write data files • save web pages and automatically extract information from them • count word frequencies • remove stop words • automatically refine searches • make n-gram dictionaries • create keyword-in-context (KWIC) displays • make tag clouds, and • harvest sets of hyperlinks Table of Contents 0. About this book...........................................................................................................................................3 1. Do you need to learn how to program?.......................................................................................................4 Techniques that don't involve programming..............................................................................................4 Why you might want to learn to program..................................................................................................4 What kind of techniques you will learn.....................................................................................................5 2. Getting started.............................................................................................................................................5 Install and set up software..........................................................................................................................5 Linux instructions.............................................................................................................................6 Mac instructions................................................................................................................................7 Windows instructions.......................................................................................................................8 "Hello world" in Python.............................................................................................................................9 Interacting with a Python shell...................................................................................................................9 Linux instructions.............................................................................................................................9 Mac instructions................................................................................................................................9 Windows instructions.....................................................................................................................10 "Hello world" in JavaScript.....................................................................................................................11 Viewing HTML files................................................................................................................................11 "Hello World" in HTML..........................................................................................................................12 "Hello World" in embedded JavaScript...................................................................................................13 Back up your work...................................................................................................................................13 Keep in touch with us...............................................................................................................................13 Other resources.........................................................................................................................................14 Suggested readings...................................................................................................................................14 3. Working with files and web pages............................................................................................................14 Making use of your ability to do close reading........................................................................................14 Sending information to text files..............................................................................................................15 Getting information from text files..........................................................................................................15 Splitting code into modules and functions...............................................................................................16 About URLs.............................................................................................................................................17 Opening URLs with Python.....................................................................................................................18 Saving a local copy of a web page...........................................................................................................19 Suggested Readings.................................................................................................................................20 4. From HTML to a list of words..................................................................................................................20 Getting rid of HTML formatting..............................................................................................................20 More about Python strings.......................................................................................................................20 Looping....................................................................................................................................................22 Branching.................................................................................................................................................22 The stripTags routine...............................................................................................................................23 Python lists...............................................................................................................................................23 Suggested Readings.................................................................................................................................25 5. Computing frequencies.............................................................................................................................25 Useful measures of a text.........................................................................................................................25 Cleaning up the list...................................................................................................................................25 Our first use of regular expressions.........................................................................................................26 Python dictionaries...................................................................................................................................27 Counting word frequencies......................................................................................................................28 From HTML to a dictionary of word-frequency pairs.............................................................................29 Removing stop words...............................................................................................................................30 Putting it all together................................................................................................................................31 Suggested Readings.................................................................................................................................32 6. Wrapping output in HTML.......................................................................................................................32 Putting new information where you can use it.........................................................................................32 Python string formatting..........................................................................................................................33 Creating HTML output............................................................................................................................33 Sending HTML output to Firefox............................................................................................................34
Recommended publications
  • Fill Your Boots: Enhanced Embedded Bootloader Exploits Via Fault Injection and Binary Analysis
    IACR Transactions on Cryptographic Hardware and Embedded Systems ISSN 2569-2925, Vol. 2021, No. 1, pp. 56–81. DOI:10.46586/tches.v2021.i1.56-81 Fill your Boots: Enhanced Embedded Bootloader Exploits via Fault Injection and Binary Analysis Jan Van den Herrewegen1, David Oswald1, Flavio D. Garcia1 and Qais Temeiza2 1 School of Computer Science, University of Birmingham, UK, {jxv572,d.f.oswald,f.garcia}@cs.bham.ac.uk 2 Independent Researcher, [email protected] Abstract. The bootloader of an embedded microcontroller is responsible for guarding the device’s internal (flash) memory, enforcing read/write protection mechanisms. Fault injection techniques such as voltage or clock glitching have been proven successful in bypassing such protection for specific microcontrollers, but this often requires expensive equipment and/or exhaustive search of the fault parameters. When multiple glitches are required (e.g., when countermeasures are in place) this search becomes of exponential complexity and thus infeasible. Another challenge which makes embedded bootloaders notoriously hard to analyse is their lack of debugging capabilities. This paper proposes a grey-box approach that leverages binary analysis and advanced software exploitation techniques combined with voltage glitching to develop a powerful attack methodology against embedded bootloaders. We showcase our techniques with three real-world microcontrollers as case studies: 1) we combine static and on-chip dynamic analysis to enable a Return-Oriented Programming exploit on the bootloader of the NXP LPC microcontrollers; 2) we leverage on-chip dynamic analysis on the bootloader of the popular STM8 microcontrollers to constrain the glitch parameter search, achieving the first fully-documented multi-glitch attack on a real-world target; 3) we apply symbolic execution to precisely aim voltage glitches at target instructions based on the execution path in the bootloader of the Renesas 78K0 automotive microcontroller.
    [Show full text]
  • The 12Th Top Chess Engine Championship
    TCEC12: the 12th Top Chess Engine Championship Article Accepted Version Haworth, G. and Hernandez, N. (2019) TCEC12: the 12th Top Chess Engine Championship. ICGA Journal, 41 (1). pp. 24-30. ISSN 1389-6911 doi: https://doi.org/10.3233/ICG-190090 Available at http://centaur.reading.ac.uk/76985/ It is advisable to refer to the publisher’s version if you intend to cite from the work. See Guidance on citing . To link to this article DOI: http://dx.doi.org/10.3233/ICG-190090 Publisher: The International Computer Games Association All outputs in CentAUR are protected by Intellectual Property Rights law, including copyright law. Copyright and IPR is retained by the creators or other copyright holders. Terms and conditions for use of this material are defined in the End User Agreement . www.reading.ac.uk/centaur CentAUR Central Archive at the University of Reading Reading’s research outputs online TCEC12: the 12th Top Chess Engine Championship Guy Haworth and Nelson Hernandez1 Reading, UK and Maryland, USA After the successes of TCEC Season 11 (Haworth and Hernandez, 2018a; TCEC, 2018), the Top Chess Engine Championship moved straight on to Season 12, starting April 18th 2018 with the same divisional structure if somewhat evolved. Five divisions, each of eight engines, played two or more ‘DRR’ double round robin phases each, with promotions and relegations following. Classic tempi gradually lengthened and the Premier division’s top two engines played a 100-game match to determine the Grand Champion. The strategy for the selection of mandated openings was finessed from division to division.
    [Show full text]
  • Game Changer
    Matthew Sadler and Natasha Regan Game Changer AlphaZero’s Groundbreaking Chess Strategies and the Promise of AI New In Chess 2019 Contents Explanation of symbols 6 Foreword by Garry Kasparov �������������������������������������������������������������������������������� 7 Introduction by Demis Hassabis 11 Preface 16 Introduction ������������������������������������������������������������������������������������������������������������ 19 Part I AlphaZero’s history . 23 Chapter 1 A quick tour of computer chess competition 24 Chapter 2 ZeroZeroZero ������������������������������������������������������������������������������ 33 Chapter 3 Demis Hassabis, DeepMind and AI 54 Part II Inside the box . 67 Chapter 4 How AlphaZero thinks 68 Chapter 5 AlphaZero’s style – meeting in the middle 87 Part III Themes in AlphaZero’s play . 131 Chapter 6 Introduction to our selected AlphaZero themes 132 Chapter 7 Piece mobility: outposts 137 Chapter 8 Piece mobility: activity 168 Chapter 9 Attacking the king: the march of the rook’s pawn 208 Chapter 10 Attacking the king: colour complexes 235 Chapter 11 Attacking the king: sacrifices for time, space and damage 276 Chapter 12 Attacking the king: opposite-side castling 299 Chapter 13 Attacking the king: defence 321 Part IV AlphaZero’s
    [Show full text]
  • Fortran Resources 1
    Fortran Resources 1 Ian D Chivers Jane Sleightholme October 17, 2020 1The original basis for this document was Mike Metcalf’s Fortran Information File. The next input came from people on comp-fortran-90. Details of how to subscribe or browse this list can be found in this document. If you have any corrections, additions, suggestions etc to make please contact us and we will endeavor to include your comments in later versions. Thanks to all the people who have contributed. 2 Revision history The most recent version can be found at https://www.fortranplus.co.uk/fortran-information/ and the files section of the comp-fortran-90 list. https://www.jiscmail.ac.uk/cgi-bin/webadmin?A0=comp-fortran-90 • October 2020. Added an entry for Nvidia to the compiler section. Nvidia has integrated the PGI compiler suite into their NVIDIA HPC SDK product. Nvidia are also contributing to the LLVM Flang project. • September 2020. Added a computer arithmetic and IEEE formats section. • June 2020. Updated the compiler entry with details of standard conformance. • April 2020. Updated the Fortran Forum entry. Damian Rouson has taken over as editor. • April 2020. Added an entry for Hewlett Packard Enterprise in the compilers section • April 2020. Updated the compiler section to change the status of the Oracle compiler. • April 2020. Added an entry in the links section to the ACM publication Fortran Forum. • March 2020. Updated the Lorenzo entry in the history section. • December 2019. Updated the compiler section to add details of the latest re- lease (7.0) of the Nag compiler, which now supports coarrays and submodules.
    [Show full text]
  • Computer Science & Information Technology 33
    Computer Science & Information Technology 33 Dhinaharan Nagamalai Sundarapandian Vaidyanathan (Eds) Computer Science & Information Technology Fifth International Conference on Computer Science, Engineering and Applications (CCSEA-2015) Dubai, UAE, January 23 ~ 24 - 2015 AIRCC Volume Editors Dhinaharan Nagamalai, Wireilla Net Solutions PTY LTD, Sydney, Australia E-mail: [email protected] Sundarapandian Vaidyanathan, R & D Centre, Vel Tech University, India E-mail: [email protected] ISSN: 2231 - 5403 ISBN: 978-1-921987-26-7 DOI : 10.5121/csit.2015.50201 - 10.5121/csit.2015.50218 This work is subject to copyright. All rights are reserved, whether whole or part of the material is concerned, specifically the rights of translation, reprinting, re-use of illustrations, recitation, broadcasting, reproduction on microfilms or in any other way, and storage in data banks. Duplication of this publication or parts thereof is permitted only under the provisions of the International Copyright Law and permission for use must always be obtained from Academy & Industry Research Collaboration Center. Violations are liable to prosecution under the International Copyright Law. Typesetting: Camera-ready by author, data conversion by NnN Net Solutions Private Ltd., Chennai, India Preface Fifth International Conference on Computer Science, Engineering and Applications (CCSEA-2015) was held in Dubai, UAE, during January 23 ~ 24, 2015. Third International Conference on Data Mining & Knowledge Management Process (DKMP 2015), International Conference on Artificial Intelligence and Applications (AIFU-2015) and Fourth International Conference on Software Engineering and Applications (SEA-2015) were collocated with the CCSEA-2015. The conferences attracted many local and international delegates, presenting a balanced mixture of intellect from the East and from the West.
    [Show full text]
  • Geany Tutorial
    How to use Geany Geany is essentially a text editor. To begin writing your program, you will need to create a new, blank file. Click on New. A new file called untitled will appear. You may start writing. As soon as you do, the option to save the file will be available. If the name of your file is in red, it means that it hasn’t been saved since the last change that is made. Click on the button called Save next to the New button. Save the file in a directory you had previously created before you launched Geany and name it main.cpp. All of the files you will write and submit to will be named specifically main.cpp. Once the .cpp has been specified, Geany will turn on its color coding feature for the C++ template. Next, we will set up our environment and then write a simple program that will print something to the screen Feel free to supply your own name in this small program Before we do anything with it, we will need to configure some options to make your life easier in this class The vertical line to the right marks the ! boundary of your code. You will need to respect this limit in that any line of code you write must not cross this line and therefore be properly, manually broken down to the next line. Your code will be printed out for The line is not where it should be, however, and grading, and if your code crosses the we will now correct it line, it will cause line-wrapping and some points will be deducted.
    [Show full text]
  • The Elinks Manual the Elinks Manual Table of Contents Preface
    The ELinks Manual The ELinks Manual Table of Contents Preface.......................................................................................................................................................ix 1. Getting ELinks up and running...........................................................................................................1 1.1. Building and Installing ELinks...................................................................................................1 1.2. Requirements..............................................................................................................................1 1.3. Recommended Libraries and Programs......................................................................................1 1.4. Further reading............................................................................................................................2 1.5. Tips to obtain a very small static elinks binary...........................................................................2 1.6. ECMAScript support?!...............................................................................................................4 1.6.1. Ok, so how to get the ECMAScript support working?...................................................4 1.6.2. The ECMAScript support is buggy! Shall I blame Mozilla people?..............................6 1.6.3. Now, I would still like NJS or a new JS engine from scratch. .....................................6 1.7. Feature configuration file (features.conf).............................................................................7
    [Show full text]
  • Fira Code: Monospaced Font with Programming Ligatures
    Personal Open source Business Explore Pricing Blog Support This repository Sign in Sign up tonsky / FiraCode Watch 282 Star 9,014 Fork 255 Code Issues 74 Pull requests 1 Projects 0 Wiki Pulse Graphs Monospaced font with programming ligatures 145 commits 1 branch 15 releases 32 contributors OFL-1.1 master New pull request Find file Clone or download lf- committed with tonsky Add mintty to the ligatures-unsupported list (#284) Latest commit d7dbc2d 16 days ago distr Version 1.203 (added `__`, closes #120) a month ago showcases Version 1.203 (added `__`, closes #120) a month ago .gitignore - Removed `!!!` `???` `;;;` `&&&` `|||` `=~` (closes #167) `~~~` `%%%` 3 months ago FiraCode.glyphs Version 1.203 (added `__`, closes #120) a month ago LICENSE version 0.6 a year ago README.md Add mintty to the ligatures-unsupported list (#284) 16 days ago gen_calt.clj Removed `/**` `**/` and disabled ligatures for `/*/` `*/*` sequences … 2 months ago release.sh removed Retina weight from webfonts 3 months ago README.md Fira Code: monospaced font with programming ligatures Problem Programmers use a lot of symbols, often encoded with several characters. For the human brain, sequences like -> , <= or := are single logical tokens, even if they take two or three characters on the screen. Your eye spends a non-zero amount of energy to scan, parse and join multiple characters into a single logical one. Ideally, all programming languages should be designed with full-fledged Unicode symbols for operators, but that’s not the case yet. Solution Download v1.203 · How to install · News & updates Fira Code is an extension of the Fira Mono font containing a set of ligatures for common programming multi-character combinations.
    [Show full text]
  • Metadefender Core V4.12.2
    MetaDefender Core v4.12.2 © 2018 OPSWAT, Inc. All rights reserved. OPSWAT®, MetadefenderTM and the OPSWAT logo are trademarks of OPSWAT, Inc. All other trademarks, trade names, service marks, service names, and images mentioned and/or used herein belong to their respective owners. Table of Contents About This Guide 13 Key Features of Metadefender Core 14 1. Quick Start with Metadefender Core 15 1.1. Installation 15 Operating system invariant initial steps 15 Basic setup 16 1.1.1. Configuration wizard 16 1.2. License Activation 21 1.3. Scan Files with Metadefender Core 21 2. Installing or Upgrading Metadefender Core 22 2.1. Recommended System Requirements 22 System Requirements For Server 22 Browser Requirements for the Metadefender Core Management Console 24 2.2. Installing Metadefender 25 Installation 25 Installation notes 25 2.2.1. Installing Metadefender Core using command line 26 2.2.2. Installing Metadefender Core using the Install Wizard 27 2.3. Upgrading MetaDefender Core 27 Upgrading from MetaDefender Core 3.x 27 Upgrading from MetaDefender Core 4.x 28 2.4. Metadefender Core Licensing 28 2.4.1. Activating Metadefender Licenses 28 2.4.2. Checking Your Metadefender Core License 35 2.5. Performance and Load Estimation 36 What to know before reading the results: Some factors that affect performance 36 How test results are calculated 37 Test Reports 37 Performance Report - Multi-Scanning On Linux 37 Performance Report - Multi-Scanning On Windows 41 2.6. Special installation options 46 Use RAMDISK for the tempdirectory 46 3. Configuring Metadefender Core 50 3.1. Management Console 50 3.2.
    [Show full text]
  • Php Editor Mac Freeware Download
    Php editor mac freeware download Davor's PHP Editor (DPHPEdit) is a free PHP IDE (Integrated Development Environment) which allows Project Creation and Management, Editing with. Notepad++ is a free and open source code editor for Windows. It comes with syntax highlighting for many languages including PHP, JavaScript, HTML, and BBEdit costs $, you can also download a free trial version. PHP editor for Mac OS X, Windows, macOS, and Linux features such as the PHP code builder, the PHP code assistant, and the PHP function list tool. Browse, upload, download, rename, and delete files and directories and much more. PHP Editor free download. Get the latest version now. PHP Editor. CodeLite is an open source, free, cross platform IDE specialized in C, C++, PHP and ) programming languages which runs best on all major Platforms (OSX, Windows and Linux). You can Download CodeLite for the following OSs. Aptana Studio (Windows, Linux, Mac OS X) (FREE) Built-in macro language; Plugins can be downloaded and installed from within jEdit using . EditPlus is a text editor, HTML editor, PHP editor and Java editor for Windows. Download For Mac For macOS or later Release notes - Other platforms Atom is a text editor that's modern, approachable, yet hackable to the core—a tool. Komodo Edit is a simple, polyglot editor that provides the basic functionality you need for programming. unit testing, collaboration, or integration with build systems, download Komodo IDE and start your day trial. (x86), Mac OS X. Download your free trial of Zend Studio - the leading PHP Editor for Zend Studio - Mac OS bit fdbbdea, Download.
    [Show full text]
  • Openoffice Spreadsheet Override Auto Capatilization
    Openoffice Spreadsheet Override Auto Capatilization Selfsame Randie thraws her anesthesia so debauchedly that Merwin spiles very raspingly. Mitral Gerrard condones synchronically, he catches his pitchstone very unpreparedly. Is Lon Muhammadan or associate when rematches some requisition tile war? For my monobook skin is a list of As arch Capital will change percentage setting in gorgeous Voice Settings dialog. What rate the 4 basic layout types? Class WriteExcel Documentation for writeexcel 104. OpenOfficeorg 3 Getting Started Calamo. Saving Report Output native Excel XLSX Format. Installed tax product to another precious you should attend Office Manager and. Sep 2015 How to boast Off Automatic Capitalization in Excel 2013 middot Click. ExportMode Defaults to 'xlsx' and uses the tow Office XML standards. HttpwwwopenofficeorglicensesPDLhtml with the additional caveat that anyone. The Source Documents window up the Change Summary window but easily be. Usually if you change this option it affects all components. Excel Export allows exporting ag-Grid data create Excel using Open XML format xlsx or its's own XML format. Lionel Elie Mamane fdo57640 Auto capitalization for letters wrong. Associating a document with somewhat different template 75. The Advantages of Apache OpenOffice Apache OpenOffice Wiki. Note We always prompt response keywords in first capital letters for clarity but the. It is based on code from Apache OpenOffice made available getting the. Citations that sort been inserted with automatic citation updates disabled would be inserted. Getting Started with LibreOffice 60 Dash. Ranges in A1 notation must restore in uppercase like outlook Excel. Open up office vs closed plan office advantages and. OpenDocument applications such as OpenOfficeorg let this change the format of.
    [Show full text]
  • Free Remote Agile E-Book
    Table of Contents 1. Welcome to a new kind of Agile 2. Establishing Ground Rules 3. Stop Dreading Meetings: The Webcam Revolution 4. The Virtual Office Setup 5. Case Study: Stack Exchange’s Hybrid Team 6. Building and Nurturing Your Remote Team 7. Best Email Practices 8. Case Study: RES Software’s Three Remote Offices 9. Agile Can Thrive With Remote Teams 10. Let Us Know How We Can Help! Welcome to a new kind of Agile The current charter of most distributed company leaders is to create an online workspace (...) supported by a set of tools and self- organizing behaviors.(...)With a strong vision, clear articulation of priorities, and strongly nurturing culture as part of your company DNA, you have a clear path to success on your distributed Agile team." - Amanda Ross, Director of Marketing & Agile Practices at Sococo It’s been called a framework, a philosophy, a methodology - research Agile and you’ll find that so many people define it with so many different words that you'd be forgiven for thinking it’s some sort of mystical practice involving tarot cards and looking at the stars. But it’s actually a major shift in the way people work, and it’s been happening for over a decade - whatever you choose to call it, if you are in the IT business, Agile is likely part of the way you work. If it’s not, the time to start is now. Companies and teams worldwide have used it to deliver better products in record time with maximum efficiency and minimum burnout.
    [Show full text]