Ruby Language

Total Page:16

File Type:pdf, Size:1020Kb

Ruby Language Ruby Language #ruby Table of Contents About 1 Chapter 1: Getting started with Ruby Language 2 Remarks 2 Versions 2 Examples 2 Hello World from IRB 2 Hello World with tk 3 Example code: 3 Hello World 4 Hello World without source files 4 Hello World as a Self-Executable File—using Shebang (Unix-like operating systems only) 4 My First Method 5 Overview 5 Explanation 5 Chapter 2: Arrays 6 Syntax 6 Examples 6 #map 6 Creating an Array with the literal constructor [ ] 6 Create Array of Strings 7 Create Array of Symbols 7 Create Array with Array::new 7 Manipulating Array Elements 8 Arrays union, intersection and difference 9 Filtering arrays 10 Select 10 Reject 10 Inject, reduce 10 Accessing elements 11 Two-dimensional array 12 Arrays and the splat (*) operator 12 Decomposition 13 Turn multi-dimensional array into a one-dimensional (flattened) array 15 Get unique array elements 15 Get all combinations / permutations of an array 15 Create an Array of consecutive numbers or letters 16 Remove all nil elements from an array with #compact 17 Create Array of numbers 17 Cast to Array from any object 18 Chapter 3: Blocks and Procs and Lambdas 20 Syntax 20 Remarks 20 Examples 20 Proc 20 Lambdas 21 Objects as block arguments to methods 22 Blocks 22 Yielding 23 Variables 24 Converting to Proc 24 Partial Application and Currying 25 Currying and Partial Applications 26 More useful examples of currying 26 Chapter 4: C Extensions 28 Examples 28 Your first extension 28 Working with C Structs 29 Writing Inline C - RubyInLine 30 Chapter 5: Casting (type conversion) 32 Examples 32 Casting to a String 32 Casting to an Integer 32 Casting to a Float 32 Floats and Integers 32 Chapter 6: Catching Exceptions with Begin / Rescue 34 Examples 34 A Basic Error Handling Block 34 Saving the Error 34 Checking for Different Errors 35 Retrying 36 Checking Whether No Error Was Raised 37 Code That Should Always Run 38 Chapter 7: Classes 40 Syntax 40 Remarks 40 Examples 40 Creating a class 40 Constructor 40 Class and instance variables 41 Accessing instance variables with getters and setters 42 Access Levels 43 Public Methods 43 Private Methods 44 Protected Methods 44 Class Methods types 45 Instance Methods 45 Class Method 46 Singleton Methods 46 Dynamic class creation 47 New, allocate, and initialize 48 Chapter 8: Command Line Apps 49 Examples 49 How to write a command line tool to get the weather by zip code 49 Chapter 9: Comments 51 Examples 51 Single & Multiple line comments 51 Chapter 10: Comparable 52 Syntax 52 Parameters 52 Remarks 52 Examples 52 Rectangle comparable by area 52 Chapter 11: Constants 54 Syntax 54 Remarks 54 Examples 54 Define a constant 54 Modify a Constant 54 Constants cannot be defined in methods 54 Define and change constants in a class 55 Chapter 12: Control Flow 56 Examples 56 if, elsif, else and end 56 Truthy and Falsy values 57 while, until 57 Inline if/unless 58 unless 58 Case statement 58 Loop control with break, next, and redo 60 break 60 next 61 redo 61 Enumerable iteration 62 Block result values 62 throw, catch 62 Control flow with logic statements 63 begin, end 64 return vs. next: non-local return in a block 64 Or-Equals/Conditional assignment operator (||=) 65 Ternary operator 66 Flip-Flop operator 66 Chapter 13: DateTime 68 Syntax 68 Remarks 68 Examples 68 DateTime from string 68 New 68 Add/substract days to DateTime 68 Chapter 14: Debugging 70 Examples 70 Stepping through code with Pry and Byebug 70 Chapter 15: Design Patterns and Idioms in Ruby 71 Remarks 71 Examples 71 Singleton 71 Observer 72 Decorator Pattern 73 Proxy 74 Chapter 16: Destructuring 78 Examples 78 Overview 78 Destructuring Block Arguments 78 Chapter 17: Dynamic Evaluation 79 Syntax 79 Parameters 79 Examples 79 Instance evaluation 79 Evaluating a String 80 Evaluating Inside a Binding 80 Dynamically Creating Methods from Strings 81 Chapter 18: Enumerable in Ruby 82 Introduction 82 Examples 82 Enumerable module 82 Chapter 19: Enumerators 86 Introduction 86 Parameters 86 Examples 86 Custom enumerators 86 Existing methods 86 Rewinding 87 Chapter 20: Environment Variables 88 Syntax 88 Remarks 88 Examples 88 Sample to get user profile path 88 Chapter 21: ERB 89 Introduction 89 Syntax 89 Remarks 89 Examples 89 Parsing ERB 89 Chapter 22: Exceptions 91 Remarks 91 Examples 91 Raising an exception 91 Creating a custom exception type 91 Handling an exception 92 Handling multiple exceptions 94 Adding information to (custom) exceptions 94 Chapter 23: File and I/O Operations 96 Parameters 96 Examples 96 Writing a string to a file 96 Open and closing a file 97 get a single char of input 97 Reading from STDIN 98 Reading from arguments with ARGV 98 Chapter 24: Gem Creation/Management 99 Examples 99 Gemspec Files 99 Building A Gem 100 Dependencies 100 Chapter 25: Gem Usage 101 Examples 101 Installing ruby gems 101 Specifying versions 101 Gem installation from github/filesystem 102 Checking if a required gem is installed from within code 102 Using a Gemfile and Bundler 103 Bundler/inline (bundler v1.10 and later) 104 Chapter 26: Generate a random number 105 Introduction 105 Remarks 105 Examples 105 6 Sided die 105 Generate a random number from a range (inclusive) 105 Chapter 27: Getting started with Hanami 106 Introduction 106 Examples 106 About Hanami 106 How to install Hanami? 106 How to start the server? 107 Chapter 28: Hashes 110 Introduction 110 Syntax 110 Remarks 110 Examples 110 Creating a hash 110 Accessing Values 111 Setting Default Values 113 Automatically creating a Deep Hash 114 Modifying keys and values 115 Iterating Over a Hash 115 Conversion to and from Arrays 116 Getting all keys or values of hash 117 Overriding hash function 117 Filtering hashes 118 Set Operations on Hashes 118 Chapter 29: Implicit Receivers and Understanding Self 120 Examples 120 There is always an implicit receiver 120 Keywords change the implicit receiver 121 When to use self? 121 Chapter 30: Inheritance 123 Syntax 123 Examples 123 Refactoring existing classes to use Inheritance 123 Multiple Inheritance 124 Subclasses 124 Mixins 124 What is inherited? 125 Chapter 31: Installation 128 Examples 128 Linux - Compiling from source 128 Linux—Installation using a package manager 128 Windows - Installation using installer 128 Gems 129 Linux - troubleshooting gem install 129 Installing Ruby macOS 130 Chapter 32: instance_eval 132 Syntax 132 Parameters 132 Examples 132 Instance evaluation 132 Implementing with 133 Chapter 33: Introspection 134 Examples 134 View an object's methods 134 Inspecting an Object 134 Inspecting a Class or Module 135 View an object's Instance Variables 135 View Global and Local Variables 136 View Class Variables 137 Chapter 34: Introspection in Ruby 138 Introduction 138 Examples 138 Lets see some examples 138 Introspection of class 140 Chapter 35: IRB 141 Introduction 141 Parameters 141 Examples 142 Basic Usage 142 Starting an IRB session inside a Ruby script 142 Chapter 36: Iteration 143 Examples 143 Each 143 Method 1: Inline 143 Method 2: Multiline 143 Implementation in a class 144 Map 144 Iterating over complex objects 145 For iterator 146 Iteration with index 146 Chapter 37: JSON with Ruby 147 Examples 147 Using JSON with Ruby 147 Using Symbols 147 Chapter 38: Keyword Arguments 148 Remarks 148 Examples 148 Using keyword arguments 149 Required keyword arguments 150 Using arbitrary keyword arguments with splat operator 150 Chapter 39: Loading Source Files 152 Examples 152 Require files to be loaded only once 152 Automatically loading source files 152 Loading optional files 152 Loading files repeatedly 153 Loading several files 153 Chapter 40: Message Passing 154 Examples 154 Introduction 154 Message Passing Through Inheritance Chain 154 Message Passing Through Module Composition 155 Interrupting Messages 156 Chapter 41: Metaprogramming 158 Introduction 158 Examples 158 Implementing "with" using instance evaluation 158 Defining methods dynamically 158 Defining methods on instances 159 send() method 159 Here is the more descriptive example 160 Chapter 42: method_missing 161 Parameters 161 Remarks 161 Examples 162 Catching calls to an undefined method 162 Using the missing method 162 Use with block 162 Use with parameter 162 Chapter 43: Methods 164 Introduction 164 Remarks 164 Overview of Method Parameters 164 Examples 165 Single required parameter 165 h11 165 Multiple required parameters 165 h12 165 Default parameters 166 h13 166 Optional parameter(s) (splat operator) 166 h14 167 Required default optional parameter mix 167 Method Definitions are Expressions 167 Capturing undeclared keyword arguments (double splat) 168 Yielding to blocks 169 Tuple Arguments 170 Defining a method 170 Use a function as a block 171 Chapter 44: Modules 172 Syntax 172 Remarks 172 Examples 172 A simple mixin with include 172 Module as Namespace 173 A simple mixin with extend 173 Modules and Class Composition 173 Chapter 45: Monkey Patching in Ruby 175 Introduction 175 Remarks 175 Examples 175 Changing any method 175 Changing an existing ruby method 175 Changing a method with parameters 175 Extending an existing class 176 Safe Monkey patching with Refinements 176 Chapter 46: Monkey Patching in Ruby 178 Examples 178 Monkey patching a class 178 Monkey patching an object 178 Chapter 47: Monkey Patching in Ruby 179 Remarks 179 Examples 179 Adding Functionality 179 Chapter 48: Multidimensional Arrays 180 Introduction 180 Examples 180 Initializing a 2D array 180 Initializing a 3D array 180 Accessing a nested array 180 Array flattening 181 Chapter 49: Numbers 182 Remarks 182 Numbers hierarchy 182 Examples 182 Creating an Integer 182 Converting a String to Integer 182 Converting a number to a string 183 Dividing two numbers 183 Rational Numbers 184 Complex Numbers 184 Even and Odd Numbers 184 Rounding Numbers 185 Chapter 50: Operating System or Shell commands 186 Introduction 186 Remarks 186 Examples 187 Recommended ways to execute shell code in Ruby: 187 Clasic ways to execute shell code in Ruby: 188 Chapter 51: Operators 190 Remarks 190 Operators are methods 190 When to use && vs.
Recommended publications
  • MANNING Greenwich (74° W
    Object Oriented Perl Object Oriented Perl DAMIAN CONWAY MANNING Greenwich (74° w. long.) For electronic browsing and ordering of this and other Manning books, visit http://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. 32 Lafayette Place Fax: (203) 661-9018 Greenwich, CT 06830 email: [email protected] ©2000 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. Library of Congress Cataloging-in-Publication Data Conway, Damian, 1964- Object oriented Perl / Damian Conway. p. cm. includes bibliographical references. ISBN 1-884777-79-1 (alk. paper) 1. Object-oriented programming (Computer science) 2. Perl (Computer program language) I. Title. QA76.64.C639 1999 005.13'3--dc21 99-27793 CIP Manning Publications Co. Copyeditor: Adrianne Harun 32 Lafayette
    [Show full text]
  • Reglas De Congo: Palo Monte Mayombe) a Book by Lydia Cabrera an English Translation from the Spanish
    THE KONGO RULE: THE PALO MONTE MAYOMBE WISDOM SOCIETY (REGLAS DE CONGO: PALO MONTE MAYOMBE) A BOOK BY LYDIA CABRERA AN ENGLISH TRANSLATION FROM THE SPANISH Donato Fhunsu A dissertation submitted to the faculty of the University of North Carolina at Chapel Hill in partial fulfillment of the requirements for the degree of Doctor of Philosophy in the Department of English and Comparative Literature (Comparative Literature). Chapel Hill 2016 Approved by: Inger S. B. Brodey Todd Ramón Ochoa Marsha S. Collins Tanya L. Shields Madeline G. Levine © 2016 Donato Fhunsu ALL RIGHTS RESERVED ii ABSTRACT Donato Fhunsu: The Kongo Rule: The Palo Monte Mayombe Wisdom Society (Reglas de Congo: Palo Monte Mayombe) A Book by Lydia Cabrera An English Translation from the Spanish (Under the direction of Inger S. B. Brodey and Todd Ramón Ochoa) This dissertation is a critical analysis and annotated translation, from Spanish into English, of the book Reglas de Congo: Palo Monte Mayombe, by the Cuban anthropologist, artist, and writer Lydia Cabrera (1899-1991). Cabrera’s text is a hybrid ethnographic book of religion, slave narratives (oral history), and folklore (songs, poetry) that she devoted to a group of Afro-Cubans known as “los Congos de Cuba,” descendants of the Africans who were brought to the Caribbean island of Cuba during the trans-Atlantic Ocean African slave trade from the former Kongo Kingdom, which occupied the present-day southwestern part of Congo-Kinshasa, Congo-Brazzaville, Cabinda, and northern Angola. The Kongo Kingdom had formal contact with Christianity through the Kingdom of Portugal as early as the 1490s.
    [Show full text]
  • Rubabel: Wrapping Open Babel with Ruby Rob Smith1*, Ryan Williamson1, Dan Ventura1 and John T Prince2*
    Smith et al. Journal of Cheminformatics 2013, 5:35 http://www.jcheminf.com/content/5/1/35 SOFTWARE Open Access Rubabel: wrapping open Babel with Ruby Rob Smith1*, Ryan Williamson1, Dan Ventura1 and John T Prince2* Abstract Background: The number and diversity of wrappers for chemoinformatic toolkits suggests the diverse needs of the chemoinformatic community. While existing chemoinformatics libraries provide a broad range of utilities, many chemoinformaticians find compiled language libraries intimidating, time-consuming, arcane, and verbose. Although high-level language wrappers have been implemented, more can be done to leverage the intuitiveness of object-orientation, the paradigms of high-level languages, and the extensibility of languages such as Ruby. We introduce Rubabel, an intuitive, object-oriented suite of functionality that substantially increases the accessibily of the tools in the Open Babel chemoinformatics library. Results: Rubabel requires fewer lines of code than any other actively developed wrapper, providing better object organization and navigation, and more intuitive object behavior than extant solutions. Moreover, Rubabel provides a convenient interface to the many extensions currently available in Ruby, greatly streamlining otherwise onerous tasks such as creating web applications that serve up Rubabel functionality. Conclusions: Rubabel is powerful, intuitive, concise, freely available, cross-platform, and easy to install. We expect it to be a platform of choice for new users, Ruby users, and some users of current solutions. Keywords: Chemoinformatics, Open Babel, Ruby Background tasks. Though it allows the user to access the functionality Despite the fact that chemoinformatics tools have been of the component libraries from one Python script, Cin- developed since the late 1990s [1], the field has yet to fony does not automatically manage underlying data types rally in support of a single library.
    [Show full text]
  • Theine2 Documentation Release Latest
    theine2 Documentation Release latest Dec 06, 2019 Contents 1 Installing 3 2 Upgrading 5 3 Using 7 4 Configuration 9 4.1 base_port and max_port.........................................9 4.2 min_free_workers............................................9 4.3 spawn_parallel..............................................9 4.4 silent................................................... 10 5 Speed up Theine 11 5.1 Tell Theine to use CRuby for the client................................. 11 6 Using with Foreman 13 7 Using with Docker 15 8 How it works 17 i ii theine2 Documentation, Release latest Theine is a Rails application pre-loader designed to work on JRuby. It is similar to Zeus, Spring and Spork. The problem with Zeus and Spring is that they use fork which doesn’t work on JRuby. An example: time rails runner"puts Rails.env" 48.31s user 1.96s system 242% cpu 20.748 total # normal time theine runner"puts Rails.env" 0.12s user 0.02s system 32% cpu 0.449 total # Theine Contents 1 theine2 Documentation, Release latest 2 Contents CHAPTER 1 Installing You need to install screen on your system. For example on Ubuntu: sudo apt-get install screen Then install the gem. gem install theine2 3 theine2 Documentation, Release latest 4 Chapter 1. Installing CHAPTER 2 Upgrading If you want to use CRuby for the client, you will probably need to re-run theine_set_ruby after upgrading. 5 theine2 Documentation, Release latest 6 Chapter 2. Upgrading CHAPTER 3 Using Start up the theine server in the root of your Rails project: theine_server or theine_start for a detached
    [Show full text]
  • Tsuru Documentation Release 1.6.2
    tsuru Documentation Release 1.6.2 tsuru Oct 04, 2018 Contents 1 Understanding 3 1.1 Overview.................................................3 1.2 Concepts.................................................4 1.3 Architecture...............................................5 2 Installing 7 2.1 tsuru Installer...............................................7 2.2 Installing tsuru components....................................... 12 3 Managing 21 3.1 Installing platforms............................................ 21 3.2 Creating a platform............................................ 22 3.3 Using Pools................................................ 23 3.4 Provisioners............................................... 25 3.5 Clusters.................................................. 26 3.6 Segregate Scheduler........................................... 27 3.7 Upgrading Docker............................................ 27 3.8 Managing Git repositories and SSH keys................................ 28 3.9 Managing users and permissions..................................... 28 3.10 Managing Application Logs....................................... 32 3.11 Debugging and Troubleshooting..................................... 33 3.12 Volumes................................................. 34 3.13 Event webhooks............................................. 35 4 Using 39 4.1 Installing tsuru client........................................... 39 4.2 Deploying................................................ 40 4.3 App-Deploy..............................................
    [Show full text]
  • Networker Module for SAP 18.2 Administration Guide CONTENTS
    Dell EMC NetWorker Module for SAP Version 18.2 Administration Guide 302-005-292 REV 02 Copyright © 2009-2019 Dell Inc. or its subsidiaries. All rights reserved. Published May 2019 Dell believes the information in this publication is accurate as of its publication date. The information is subject to change without notice. THE INFORMATION IN THIS PUBLICATION IS PROVIDED “AS-IS.“ DELL MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WITH RESPECT TO THE INFORMATION IN THIS PUBLICATION, AND SPECIFICALLY DISCLAIMS IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. USE, COPYING, AND DISTRIBUTION OF ANY DELL SOFTWARE DESCRIBED IN THIS PUBLICATION REQUIRES AN APPLICABLE SOFTWARE LICENSE. Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. Other trademarks may be the property of their respective owners. Published in the USA. Dell EMC Hopkinton, Massachusetts 01748-9103 1-508-435-1000 In North America 1-866-464-7381 www.DellEMC.com 2 NetWorker Module for SAP 18.2 Administration Guide CONTENTS Figures 9 Tables 11 Preface 13 Chapter 1 Overview of NMSAP Features 17 Road map for NMSAP operations............................................................... 18 Terminology that is used in this guide......................................................... 19 Importance of backups and the backup lifecycle.........................................19 NMSAP features for all supported applications.......................................... 20 Scheduled backups........................................................................20
    [Show full text]
  • Hbase: the Definitive Guide
    HBase: The Definitive Guide HBase: The Definitive Guide Lars George Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo HBase: The Definitive Guide by Lars George Copyright © 2011 Lars George. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/institutional sales department: (800) 998-9938 or [email protected]. Editors: Mike Loukides and Julie Steele Indexer: Angela Howard Production Editor: Jasmine Perez Cover Designer: Karen Montgomery Copyeditor: Audrey Doyle Interior Designer: David Futato Proofreader: Jasmine Perez Illustrator: Robert Romano Printing History: September 2011: First Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. HBase: The Definitive Guide, the image of a Clydesdale horse, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions, or for damages resulting from the use of the information con- tained herein. ISBN: 978-1-449-39610-7 [LSI] 1314323116 For my wife Katja, my daughter Laura, and son Leon.
    [Show full text]
  • Download the 2021 IEEE Thesaurus
    2021 IEEE Thesaurus Version 1.0 Created by The Institute of Electrical and Electronics Engineers (IEEE) 2021 IEEE Thesaurus The IEEE Thesaurus is a controlled The IEEE Thesaurus also provides a vocabulary of almost 10,900 descriptive conceptual map through the use of engineering, technical and scientific terms, semantic relationships such as broader as well as IEEE-specific society terms terms (BT), narrower terms (NT), 'used for' [referred to as “descriptors” or “preferred relationships (USE/UF), and related terms terms”] .* Each descriptor included in the (RT). These semantic relationships identify thesaurus represents a single concept or theoretical connections between terms. unit of thought. The descriptors are Italic text denotes Non-preferred terms. considered the preferred terms for use in Bold text is used for preferred headings. describing IEEE content. The scope of descriptors is based on the material presented in IEEE journals, conference Abbreviations used in the Thesaurus: papers, standards, and/or IEEE organizational material. A controlled BT - Broader term vocabulary is a specific terminology used in NT - Narrower term a consistent and controlled fashion that RT - Related term results in better information searching and USE- Use preferred term retrieval. UF - Used for Thesaurus construction is based on the ANSI/NISO Z39.19-2005(2010) standard, Guidelines for the Construction, Format, and Management of Monolingual Controlled Vocabulary. The Thesaurus vocabulary uses American-based spellings with cross references to British variant spellings. The scope and structure of the IEEE Thesaurus reflects the engineering and scientific disciplines that comprise the Societies, Councils, and Communities of the IEEE in *Refer to ANSI/NISO NISO Z39.19-2005 addition to the technologies IEEE serves.
    [Show full text]
  • Rmenu Raspberry PI 3B+ Rmenu 環境構築 Raspberry PI3B+ Rmenu
    RaspberryPi3-20190706 RaspberryPI3 Rmenu VPS Rmenu Raspberry PI 3B+ Rmenu 環境構築 Raspberry PI3B+ Rmenu development term 2019/07/06 1 目次 第1章 はじめに ................................................................................................................................... 4 第2章 構築作業、SD イメージ作成 ................................................................................................... 5 1. Raspbian Buster Lite を ダウンロード ......................................................................... 5 2. SD メモリカードフォーマッターを取得しインストール ................................................ 6 3. SD カードをフォーマットします ................................................................................... 8 4. img ファイルの書き込みプログラムのインストール...................................................... 9 5. img ファイルの書き込み ................................................................................................ 9 6. ssh ファイルの書き込み ............................................................................................... 10 7. SD カードを取り付け、電源を入れる .......................................................................... 11 第3章 最初のログイン ...................................................................................................................... 12 1. ルータが付与した IP アドレスへログイン ................................................................... 12 第4章 Linux raspberrypi 初期設定 ................................................................................................. 13 1. ログイン .....................................................................................................................
    [Show full text]
  • Expert Python Programming Third Edition
    Expert Python Programming Third Edition Become a master in Python by learning coding best practices and advanced programming concepts in Python 3.7 Michał Jaworski Tarek Ziadé BIRMINGHAM - MUMBAI Expert Python Programming Third Edition Copyright © 2019 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. Commissioning Editor: Kunal Chaudhari Acquisition Editor: Chaitanya Nair Content Development Editor: Zeeyan Pinheiro Technical Editor: Ketan Kamble Copy Editor: Safis Editing Project Coordinator: Vaidehi Sawant Proofreader: Safis Editing Indexer: Priyanka Dhadke Graphics: Alishon Mendonsa Production Coordinator: Shraddha Falebhai First published: September 2008 Second edition: May 2016 Third edition: April 2019 Production reference: 1270419 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78980-889-6 www.packtpub.com To my beloved wife, Oliwia, for her love, inspiration, and her endless patience.
    [Show full text]
  • Introduction to GNU/Linux and the Shell 07/10/2019 | J
    Introduction to GNU/Linux and the Shell 07/10/2019 | J. Albert-von der Gönna Leibniz Supercomputing Centre Bavarian Academy of Sciences and Humanities IT Service Backbone for the Advancement of Science and Research Computer Centre 250 for all Munich Universities employees approx. Regional Computer Centre for all Bavarian Universities National Supercomputing Centre 57 (GCS) years of European Supercomputing Centre IT support (PRACE) Introduction to GNU/Linux and the Shell | 07/10/2019 | J. Albert-von der Gönna 3 Course Information • The aim of this course is to provide an introduction to GNU/Linux and the Unix Shell • You will probably benefit the most, if you’re not yet familiar with GNU/Linux and the Unix Shell, but if you plan to work on the HPC and/or Compute Cloud infrastructure provided by LRZ -> by the end of this workshop, you should have the basic skills to successfully interact with GNU/Linux-based systems • Consider the following – especially during hands-on sessions: -> you may want to partner up with the person sitting next to you -> it may be beneficial to sit back and watch the slides/demos -> the slides will be made available after the workshop -> generally: please ask, if you have any questions Introduction to GNU/Linux and the Shell | 07/10/2019 | J. Albert-von der Gönna 4 What is GNU/Linux • Free and open-source operating system • Alternative to Microsoft Windows, Apple macOS, Google Android … • Generally consists of the Linux kernel, libraries and tools, a desktop environment and various applications (e.g. web browser, office suite, …) • Different distributions: Arch Linux, Debian, Fedora/RHEL, openSUSE/SLES, Ubuntu, … Introduction to GNU/Linux and the Shell | 07/10/2019 | J.
    [Show full text]
  • Specialising Dynamic Techniques for Implementing the Ruby Programming Language
    SPECIALISING DYNAMIC TECHNIQUES FOR IMPLEMENTING THE RUBY PROGRAMMING LANGUAGE A thesis submitted to the University of Manchester for the degree of Doctor of Philosophy in the Faculty of Engineering and Physical Sciences 2015 By Chris Seaton School of Computer Science This published copy of the thesis contains a couple of minor typographical corrections from the version deposited in the University of Manchester Library. [email protected] chrisseaton.com/phd 2 Contents List of Listings7 List of Tables9 List of Figures 11 Abstract 15 Declaration 17 Copyright 19 Acknowledgements 21 1 Introduction 23 1.1 Dynamic Programming Languages.................. 23 1.2 Idiomatic Ruby............................ 25 1.3 Research Questions.......................... 27 1.4 Implementation Work......................... 27 1.5 Contributions............................. 28 1.6 Publications.............................. 29 1.7 Thesis Structure............................ 31 2 Characteristics of Dynamic Languages 35 2.1 Ruby.................................. 35 2.2 Ruby on Rails............................. 36 2.3 Case Study: Idiomatic Ruby..................... 37 2.4 Summary............................... 49 3 3 Implementation of Dynamic Languages 51 3.1 Foundational Techniques....................... 51 3.2 Applied Techniques.......................... 59 3.3 Implementations of Ruby....................... 65 3.4 Parallelism and Concurrency..................... 72 3.5 Summary............................... 73 4 Evaluation Methodology 75 4.1 Evaluation Philosophy
    [Show full text]