The document discusses Ruby file input/output (I/O) and directory functionality. It covers Ruby classes like IO, File, and Dir that provide methods for reading, writing, opening, closing, renaming, and deleting files. It also discusses creating and navigating directories. Some key file I/O methods include read, write, gets, puts, readline, sysread, and syswrite. Directory methods include chdir, pwd, entries, mkdir, and delete. The document provides examples of using these various Ruby file and directory functions.
The document discusses various file handling functions in C like fseek(), ftell(), rewind(), fgets(), fputs(), fflush(), rename(), remove(), freopen(), ferror(), fgetpos(), fsetpos() and command line arguments. Some key functions covered are:
- fseek() moves the file position indicator within a file.
- ftell() returns the current file position indicator.
- rewind() resets the file position indicator to the beginning of the file.
- fgets() and fputs() reads/writes strings to a file stream.
- rename() changes the name of a file. remove() deletes a file.
- freopen() redirects file streams like
This document provides a summary of basic Unix commands for participants of the SOI Asia Workshop 2008. It includes commands for user accounts, manual pages, processes, directories, files, networking and vi text editing. Participants are instructed to practice the commands on the SOI Asia server under guidance of senior operators to become familiar with Unix basics needed for the workshop lectures.
Files and directories can be manipulated in Python using various functions. Files are opened, read from and written to using methods like open(), read(), write() and close(). Directories can be created, listed, changed and deleted using os module functions like mkdir(), listdir(), chdir() and rmdir(). File operations involve opening, performing read/write and closing the file.
This document presents an overview of file operations and data parsing in Python. It covers opening, reading, writing, and closing files, as well as using regular expressions to parse text data through functions like re.search(), re.findall(), re.split(), and re.sub(). Examples are provided for reading and writing files, manipulating file pointers, saving complex data with pickle, and using regular expressions to match patterns and extract or replace substrings in texts. The document aims to introduce Python tools for working with files and parsing textual data.
The document discusses files in Python. It defines a file as an object that stores data, information, settings or commands used with a computer program. There are two main types of files - text files which store data as strings, and binary files which store data as bytes. The document outlines how to open, read, write, append, close and manipulate files in Python using functions like open(), read(), write(), close() etc. It also discusses pickling and unpickling objects to binary files for serialization. Finally, it covers working with directories and running other programs from Python.
This document discusses files in Python. It begins by defining what a file is and explaining that files enable persistent storage on disk. It then covers opening, reading from, and writing to files in Python. The main types of files are text and binary, and common file operations are open, close, read, and write. It provides examples of opening files in different modes, reading files line by line or in full, and writing strings or lists of strings to files. It also discusses searching files and handling errors when opening files. In the end, it presents some exercises involving copying files, counting words in a file, and converting decimal to binary.
The document discusses file handling in C++. It explains that files store data permanently on storage devices and can be opened for input or output by programs. Streams act as an interface between files and programs, representing the flow of data. The predefined stream classes like ifstream, ofstream, and fstream allow reading from and writing to files. The document outlines the general steps to work with files, describes file modes and pointers, and provides examples of reading from and writing to both text and binary files in C++.
From Tek-X Cross Platform interoperability with PHP including history lesson, a bit about each category of operating systems, and gotchas related to PHP
The document discusses file handling in C++. It describes how to perform input/output operations on files using streams. There are three types of streams - input streams, output streams, and input/output streams. Key functions for file handling include open(), close(), get(), getline(), read(), write(), tellg(), tellp(), seekg(), seekp(), and eof(). An example program demonstrates how to add, view, search, delete, and update records in a binary file using file handling functions.
This document discusses file handling in Python. It begins by explaining that files allow permanent storage of data, unlike standard input/output which is volatile. It then covers opening files in different modes, reading files line-by-line or as a whole, and modifying the file pointer position using seek(). Key points include opening files returns a file object, reading can be done line-by-line with for loops or using read()/readlines(), and seek() allows changing the file pointer location.
This document discusses Python file handling and operations. It covers opening, reading, writing, closing, and modifying files. Some key points include:
- The open() function is used to open a file and returns a stream object. This object has methods like read(), write(), seek() to interact with the file.
- Files can be opened in read, write, append, and binary modes. The default is read mode.
- To read a file, the stream object's read() method is used. seek() allows changing the read position.
- Writing requires opening in write or append mode and using write() on the stream.
- It is important to close files to free resources using the close() method
The document provides an overview of Unix and shell scripting. It discusses the history and architecture of Unix operating systems. It then covers various Unix commands and utilities for file management, processes, communication, and system administration. Finally, it describes the basics of shell scripting including variables, conditional statements, loops, and here documents.
This is the sixth set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
The document discusses Perl programming and is divided into 5 modules: 1) Introduction to Perl, 2) Regular Expressions, 3) File Handling, 4) Connecting to Databases, and 5) Introduction to Perl Programming. It provides an overview of Perl variables, data types, operators, and basic programming structures. It also covers installing Perl, Perl modules, and interacting with files and databases.
The document discusses file handling in Python. It explains that a file is used to permanently store data in non-volatile memory. It describes opening, reading, writing, and closing files. It discusses opening files in different modes like read, write, append. It also explains attributes of file objects like name, closed, and mode. The document also covers reading and writing text and binary files, pickle module for serialization, and working with CSV files and the os.path module.
This document provides an introduction and overview of shell scripting in Linux. It discusses what a shell script is, when they should and should not be used, examples of common shell scripts, and an introduction to programming features commonly used in shell scripts such as variables, conditionals, loops, command line arguments, and more. Key points covered include that shell scripts allow automating command execution, are useful for repetitive tasks, and come with programming features to customize behavior.
The document discusses the Bash shell, which is the most popular shell in Linux. It is an sh-compatible shell that incorporates useful features from other shells like Korn and C shells. Bash can be used both interactively and for scripting purposes. The document provides examples of basic Bash scripts that use variables, command substitution, arithmetic evaluation, and conditional statements. It also discusses environmental variables and the read command.
This document provides an overview of shell programming basics. It covers topics such as basic system commands like ls, cp, and rm; useful operations like wildcards and input/output redirection; shell variables; command substitution; decision making and loops; and other features like comments and head/tail utilities. The goal of the document is to introduce the reader to the core components of shell scripting.
The document discusses file input/output in C++. It covers the header file fstream.h, stream classes like ifstream and ofstream for file input/output, opening and closing files, reading/writing characters and objects to files, detecting end of file, moving file pointers for random access, and handling errors. Functions like open(), close(), get(), put(), read(), write(), seekg(), seekp(), tellg(), tellp(), eof(), fail(), bad(), good(), and clear() are described.
The document discusses file handling in C++. It defines a file as a collection of information stored on a computer's disk. There are three main steps to processing a file in C++: opening the file, reading/writing information to the file, and closing the file. It also describes different file stream classes like ifstream for input and ofstream for output that are used to read from and write to files. Functions like seekg() and seekp() allow manipulating the file pointer position.
OpenGurukul : Language : Shell ScriptingOpen Gurukul
This document provides an introduction to Unix shell scripting. It discusses how the shell program acts as an interface between the user and operating system on Unix systems. It then covers some popular shell programs like bash, ksh, and csh. The document explains what a shell script is and how to create, execute, and add comments to shell scripts. It also covers important shell scripting concepts like variables, program arguments, and the test command.
Data file handling in python reading & writing methodskeeeerty
This document discusses various methods for reading and writing files in Python. It describes readline(), readlines(), and read() methods for reading files line-by-line or in full. It also covers write() and writelines() methods for writing strings or lists to files, and discusses opening files in different modes and manipulating the file pointer position. Standard input, output, and error streams are also briefly explained.
The document is a summer training report submitted by Saikat Das, who completed training in Developing Dynamic Web Application with MYSQL and PHP (Part A), and Introduction to Security and Ethical Hacking (Part B). For Part A, the training covered topics like installing WAMP, using PHP and MySQL to build dynamic websites, managing databases and queries. For Part B, the training discussed the importance of security, threats/attacks, hardening systems, and ethical hacking techniques. The report provides details of the course agenda, concepts, and commands covered during the training.
Unix Shell Scripts supports conditional statements like if-else and case statements to perform different actions based on conditions. The document discusses the syntax and examples of if-else statements with if-fi, if-else-fi, and if-elif-else-fi blocks. It also covers the case-esac statement for multi-way branching based on a variable. Finally, it explains while, for, and until loops for repetitive execution of statements until a condition is met.
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on File Handling with Python covers all the important aspects of using files in Python right from the introduction to what fields are, all the way till checking out the major aspects of working with files and using the code-first approach to understand them better.
Python Tutorial Playlist: https://goo.gl/WsBpKe
Blog Series: http://bit.ly/2sqmP4s
Follow us to never miss an update in the future.
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
This document discusses shell programming in UNIX/Linux. It covers shell scripts, variables, operators, and logic structures used in shell programming. Shell scripts are text files that contain UNIX commands and do not need compilation. Common shells are Bourne, Bash, Korn and C shells. Variables, operators, and logic structures like if/else, for/while loops, and switch statements allow for programming logic and control flow in shell scripts.
Shell programming allows users to communicate with and run commands on a UNIX system through shell programs that interpret commands. There are several types of shells including Bourne shell, Bourne Again shell, C shell, and Korn shell. Shell scripts can be written to automate tasks using shell variables, control structures, and built-in commands. System scripts use shell programming for important system processes and services.
Hashes in Ruby are collections of key-value pairs similar to arrays but where indexing is done using keys of any object type rather than integers. Keys and values can be any object including arrays. Hashes have many built-in methods for accessing, modifying, and traversing key-value pairs including fetch, delete, each, keys, values, merge, and more. Creating a hash can be done using Hash.new or Hash[] and default values can be set.
This document discusses two Ruby iterators: each and collect. The each iterator returns each element of an array or hash and executes a block of code for each. Collect returns a new array containing the return values of its block for each element or just returns the original collection. Examples demonstrate using each to print array elements and collect to multiply array elements by 10 and return a new array.
The document discusses file handling in C++. It describes how to perform input/output operations on files using streams. There are three types of streams - input streams, output streams, and input/output streams. Key functions for file handling include open(), close(), get(), getline(), read(), write(), tellg(), tellp(), seekg(), seekp(), and eof(). An example program demonstrates how to add, view, search, delete, and update records in a binary file using file handling functions.
This document discusses file handling in Python. It begins by explaining that files allow permanent storage of data, unlike standard input/output which is volatile. It then covers opening files in different modes, reading files line-by-line or as a whole, and modifying the file pointer position using seek(). Key points include opening files returns a file object, reading can be done line-by-line with for loops or using read()/readlines(), and seek() allows changing the file pointer location.
This document discusses Python file handling and operations. It covers opening, reading, writing, closing, and modifying files. Some key points include:
- The open() function is used to open a file and returns a stream object. This object has methods like read(), write(), seek() to interact with the file.
- Files can be opened in read, write, append, and binary modes. The default is read mode.
- To read a file, the stream object's read() method is used. seek() allows changing the read position.
- Writing requires opening in write or append mode and using write() on the stream.
- It is important to close files to free resources using the close() method
The document provides an overview of Unix and shell scripting. It discusses the history and architecture of Unix operating systems. It then covers various Unix commands and utilities for file management, processes, communication, and system administration. Finally, it describes the basics of shell scripting including variables, conditional statements, loops, and here documents.
This is the sixth set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
The document discusses Perl programming and is divided into 5 modules: 1) Introduction to Perl, 2) Regular Expressions, 3) File Handling, 4) Connecting to Databases, and 5) Introduction to Perl Programming. It provides an overview of Perl variables, data types, operators, and basic programming structures. It also covers installing Perl, Perl modules, and interacting with files and databases.
The document discusses file handling in Python. It explains that a file is used to permanently store data in non-volatile memory. It describes opening, reading, writing, and closing files. It discusses opening files in different modes like read, write, append. It also explains attributes of file objects like name, closed, and mode. The document also covers reading and writing text and binary files, pickle module for serialization, and working with CSV files and the os.path module.
This document provides an introduction and overview of shell scripting in Linux. It discusses what a shell script is, when they should and should not be used, examples of common shell scripts, and an introduction to programming features commonly used in shell scripts such as variables, conditionals, loops, command line arguments, and more. Key points covered include that shell scripts allow automating command execution, are useful for repetitive tasks, and come with programming features to customize behavior.
The document discusses the Bash shell, which is the most popular shell in Linux. It is an sh-compatible shell that incorporates useful features from other shells like Korn and C shells. Bash can be used both interactively and for scripting purposes. The document provides examples of basic Bash scripts that use variables, command substitution, arithmetic evaluation, and conditional statements. It also discusses environmental variables and the read command.
This document provides an overview of shell programming basics. It covers topics such as basic system commands like ls, cp, and rm; useful operations like wildcards and input/output redirection; shell variables; command substitution; decision making and loops; and other features like comments and head/tail utilities. The goal of the document is to introduce the reader to the core components of shell scripting.
The document discusses file input/output in C++. It covers the header file fstream.h, stream classes like ifstream and ofstream for file input/output, opening and closing files, reading/writing characters and objects to files, detecting end of file, moving file pointers for random access, and handling errors. Functions like open(), close(), get(), put(), read(), write(), seekg(), seekp(), tellg(), tellp(), eof(), fail(), bad(), good(), and clear() are described.
The document discusses file handling in C++. It defines a file as a collection of information stored on a computer's disk. There are three main steps to processing a file in C++: opening the file, reading/writing information to the file, and closing the file. It also describes different file stream classes like ifstream for input and ofstream for output that are used to read from and write to files. Functions like seekg() and seekp() allow manipulating the file pointer position.
OpenGurukul : Language : Shell ScriptingOpen Gurukul
This document provides an introduction to Unix shell scripting. It discusses how the shell program acts as an interface between the user and operating system on Unix systems. It then covers some popular shell programs like bash, ksh, and csh. The document explains what a shell script is and how to create, execute, and add comments to shell scripts. It also covers important shell scripting concepts like variables, program arguments, and the test command.
Data file handling in python reading & writing methodskeeeerty
This document discusses various methods for reading and writing files in Python. It describes readline(), readlines(), and read() methods for reading files line-by-line or in full. It also covers write() and writelines() methods for writing strings or lists to files, and discusses opening files in different modes and manipulating the file pointer position. Standard input, output, and error streams are also briefly explained.
The document is a summer training report submitted by Saikat Das, who completed training in Developing Dynamic Web Application with MYSQL and PHP (Part A), and Introduction to Security and Ethical Hacking (Part B). For Part A, the training covered topics like installing WAMP, using PHP and MySQL to build dynamic websites, managing databases and queries. For Part B, the training discussed the importance of security, threats/attacks, hardening systems, and ethical hacking techniques. The report provides details of the course agenda, concepts, and commands covered during the training.
Unix Shell Scripts supports conditional statements like if-else and case statements to perform different actions based on conditions. The document discusses the syntax and examples of if-else statements with if-fi, if-else-fi, and if-elif-else-fi blocks. It also covers the case-esac statement for multi-way branching based on a variable. Finally, it explains while, for, and until loops for repetitive execution of statements until a condition is met.
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on File Handling with Python covers all the important aspects of using files in Python right from the introduction to what fields are, all the way till checking out the major aspects of working with files and using the code-first approach to understand them better.
Python Tutorial Playlist: https://goo.gl/WsBpKe
Blog Series: http://bit.ly/2sqmP4s
Follow us to never miss an update in the future.
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
This document discusses shell programming in UNIX/Linux. It covers shell scripts, variables, operators, and logic structures used in shell programming. Shell scripts are text files that contain UNIX commands and do not need compilation. Common shells are Bourne, Bash, Korn and C shells. Variables, operators, and logic structures like if/else, for/while loops, and switch statements allow for programming logic and control flow in shell scripts.
Shell programming allows users to communicate with and run commands on a UNIX system through shell programs that interpret commands. There are several types of shells including Bourne shell, Bourne Again shell, C shell, and Korn shell. Shell scripts can be written to automate tasks using shell variables, control structures, and built-in commands. System scripts use shell programming for important system processes and services.
Hashes in Ruby are collections of key-value pairs similar to arrays but where indexing is done using keys of any object type rather than integers. Keys and values can be any object including arrays. Hashes have many built-in methods for accessing, modifying, and traversing key-value pairs including fetch, delete, each, keys, values, merge, and more. Creating a hash can be done using Hash.new or Hash[] and default values can be set.
This document discusses two Ruby iterators: each and collect. The each iterator returns each element of an array or hash and executes a block of code for each. Collect returns a new array containing the return values of its block for each element or just returns the original collection. Examples demonstrate using each to print array elements and collect to multiply array elements by 10 and return a new array.
The document discusses input/output (IO) and file handling in Ruby. It explains that the IO class is the basis for all input and output, and that the File class allows reading and writing files as it is a subclass of IO. It then provides examples of how to open, read, write, iterate over, and get metadata from files and directories in Ruby.
This document discusses working with dates and times in Ruby. It provides examples of getting the current date and time, extracting components of dates and times like year, month, day, and formatting dates and times in different formats. It also covers time arithmetic, timezones, and daylight savings time.
Ruby arrays are ordered collections that can hold any object type. They are indexed starting at 0, can dynamically grow in size, and provide many built-in methods. Some key characteristics of Ruby arrays include:
1) They are ordered and associate each element with an integer index. Negative indices count backward from the end.
2) Arrays can be created and initialized in several ways such as with Array.new or [].
3) Arrays provide over 70 built-in methods for accessing, modifying, and manipulating array elements like fetch, push, pop, insert, delete, and more.
Ranges in Ruby can represent sequences, conditions, and intervals. Ranges use the ".." and "..." operators to define inclusive and exclusive sequences. Ranges can iterate over their values, test membership, find minimum/maximum values, and reject values. Ranges are also used as conditional expressions to check if a value falls within the start and end points, and in case statements to check different ranges.
This document provides information about Ruby strings, including:
- Strings can be created using single or double quotes, and support escape characters
- Strings support expression interpolation using #{expression}
- Methods like gsub, slice, and split can be used to manipulate and extract parts of strings
- Built-in string methods allow tasks like changing case, formatting strings, searching/matching substrings
- Strings have methods for operations like concatenation, comparison, indexing, and conversion between other types
This document discusses 8 key life and leadership lessons shared in the 2016 Stanford GSB View From The Top guest speaker series. It explores takeaways from leaders who spoke at Stanford about their experiences and advice. The document aims to provide insights for developing leadership skills.
The document discusses Ruby's input and output capabilities. It covers:
- Ruby provides two interfaces for I/O - simple print/gets methods and more advanced methods in the Kernel module.
- All I/O is handled by the IO base class, which File and BasicSocket subclass. IO objects represent bidirectional channels between Ruby and external resources.
- Files can be opened for reading, writing or both using File.new/File.open, specifying a mode. File streams support various methods for reading and writing lines and bytes.
- Random access methods like pos, tell, seek allow reading/writing specific locations in files and strings.
This document discusses input/output (IO) and file handling in Ruby. The IO class is the basis for all input and output in Ruby. File objects allow reading and writing files and are a subclass of IO. Common file opening modes are described like "r" for read-only. The File class can open files and a block can be passed to File.open. Methods like gets, read, rewind, each are used to read files. Directories can be accessed using the Dir class and its methods like entries.
This document provides an overview of the Ruby programming language. It discusses that Ruby is an object-oriented scripting language created by Yukihiro Matsumoto, and can run on various platforms like Windows, Mac OS, and UNIX. It also summarizes key Ruby concepts like Interactive Ruby Shell (IRb), syntax, data types, variables, and predefined variables.
Ruby is an object-oriented programming language where everything is an object. There are multiple ways to install Ruby, including using RailsInstaller, compiling from source, or using a package manager like RVM. Common data types in Ruby include numbers, strings, ranges, and objects. Methods can be defined and called, and may accept blocks of code. Classes define objects and can use attributes, class variables, class methods, and access control levels like private and public.
Ruby is a dynamic, open source programming language that was created in 1993 by Yukihiro Matsumoto who wanted to ensure that programming is simple, practical and enjoyable. It combines object-oriented and imperative programming and provides automatic memory management. Some key aspects of Ruby include being dynamically typed, following the principle of least surprise, and being multi-paradigm supporting object-oriented, functional and imperative programming.
The document discusses the different types of variables in Ruby including global variables, instance variables, class variables, local variables, constants, pseudo-variables, and literals. It provides examples of how to declare and use each variable type in Ruby code. It also covers the basic data types like integers, floats, strings, arrays, hashes, and ranges that can be used as literals in Ruby.
The document summarizes what Keith Bennett loves about the Ruby programming language. It highlights several key features including the simplicity of creating accessors and mutators for instance variables, concise syntax for conditional initialization, ability to specify arrays and hashes as literals, built-in support for regular expressions, and clean syntax for common string operations. The document provides examples of how these features can be used in Ruby.
The document summarizes what Keith Bennett loves about the Ruby programming language. It highlights several key features including the simplicity of creating accessors and mutators for instance variables, concise syntax for conditional initialization, ability to specify arrays and hashes as literals, built-in support for regular expressions, and clean syntax for common string operations. The document provides examples of how these features can be used in Ruby.
The document summarizes what Keith Bennett loves about the Ruby programming language. It highlights several key features including the simplicity of creating accessors and mutators for instance variables, concise syntax for conditional initialization, ability to specify arrays and hashes as literals, built-in support for regular expressions, and clean syntax for common string operations. The document provides examples of how these features can be used in Ruby.
The document summarizes what Keith Bennett loves about the Ruby programming language. It highlights several key features including the simplicity of creating accessors and mutators for instance variables, concise syntax for conditional initialization, ability to specify arrays and hashes as literals, built-in support for regular expressions, and clean syntax for common string operations. The document provides examples of how these features can be used in Ruby.
The document summarizes what Keith Bennett loves about the Ruby programming language. It highlights several key features including the simplicity of creating accessors and mutators for instance variables, concise syntax for conditional initialization, ability to specify numeric constants with thousands separators, easy integration with shell commands, logical syntax for iteration, ability to specify arrays and hashes as literals, built-in support for ranges, use of blocks to automatically close resources like files, simple file operations using built-in methods, clean syntax, support for regular expressions, and built-in methods for common string operations.
The document summarizes what Keith Bennett loves about the Ruby programming language. It highlights several key features including the simplicity of creating accessors and mutators for instance variables, concise syntax for conditional initialization, ability to specify arrays and hashes as literals, built-in support for regular expressions, and clean syntax for common string operations. The document provides examples of how these features can be used in Ruby.
The document summarizes what Keith Bennett loves about the Ruby programming language. It highlights several key features including the simplicity of creating accessors and mutators for instance variables, concise syntax for conditional initialization, ability to specify arrays and hashes as literals, built-in support for regular expressions, and clean syntax for common string operations. The document provides examples of how these features can be used in Ruby.
The document summarizes what the author loves about Ruby, including its simplicity in creating accessors and mutators for instance variables, concise syntax for conditional initialization, ability to specify numeric constants with thousands separators, easy shell integration, logical syntax for iteration, ability to specify arrays and hashes as literals, use of blocks to automatically close resources, and built-in support for common string operations.
The document summarizes what Keith Bennett loves about the Ruby programming language. It highlights several key features including the simplicity of creating accessors and mutators for instance variables, concise syntax for conditional initialization, ability to specify numeric constants with thousands separators, easy integration with shell commands, logical syntax for iteration, ability to specify arrays and hashes as literals, built-in support for ranges, use of blocks to automatically close resources like files, simple file operations, clean syntax, and built-in string operations.
This document provides a summary of topics covered in Week 5 of a Ruby review, including Git, objects, RSpec, IO, files, directories, Rakefile, and Rake tasks. Key points covered include using Git commands like init, add, commit, and log, understanding Ruby objects and relationships, using RSpec matchers and describing code, reading from and writing to files, creating and navigating directories, and defining tasks in a Rakefile with dependencies.
This document summarizes an introductory computer science class that teaches Ruby programming. It introduces the course, resources, instructors, and covers data types, variables, math operations, string methods, printing to the screen, comments, and naming conventions. The class assumes no prior experience and aims to teach programming fundamentals in Ruby, an easy-to-learn and widely used language.
Learn Ruby Programming in Amc Square LearningASIT Education
AMC Squarelearning Bangalore is the best training institute for a career development. it had students from various parts of the country and even few were from West African countries.
1. The document discusses the history and features of the Ruby programming language. It was created in the mid-1990s by Yukihiro Matsumoto in Japan and was influenced by other languages like Perl, Smalltalk, Eiffel, Ada, and LISP. Ruby supports object-oriented, functional, and imperative programming paradigms.
2. The document provides an introduction to some basic concepts in Ruby including variables, data types, methods, blocks, and control structures. It explains how to define variables, write methods with parameters and returns values, pass blocks to methods, and use conditional and looping statements.
3. The document covers various Ruby string functions and regular expressions. It demonstrates
This document discusses Ruby data types including numbers, text, arrays, hashes, ranges, symbols, and objects. It provides details on integer and float numbers, strings, string operations, arrays and common array methods, hashes and hash syntax, ranges and how they work, symbols and how they differ from strings, and Ruby objects and operations like equal?, conversions and tainting objects.
Ruby modules allow grouping of related methods and constants in a namespace to avoid naming collisions. Modules can be included in classes using the 'include' statement, providing a way for classes to inherit functionality from multiple modules, implementing a form of multiple inheritance known as a mixin. Modules define a namespace and methods are called using the module name and a period. The 'require' statement loads module files so their contents can be used.
Ruby allows defining reusable blocks of code that can be invoked from methods using the yield statement. A block consists of code enclosed in curly braces and is associated with a method of the same name. The yield statement passes control to the block and can optionally pass parameters to the block. Ruby files can also define BEGIN and END blocks to specify code to run as the file loads and after program execution completes, respectively.
Ruby methods are used to bundle repeatable statements into a single unit. Method names should begin with a lowercase letter. Methods should be defined before calling them. Methods can accept parameters with default values. Variables can be returned from methods. The return statement is used to return values explicitly. Methods can take a variable number of parameters using *. Class methods can be accessed without instantiating an object. The alias statement creates an alias for a method or variable. The undef statement cancels a method definition.
The document discusses various loop constructs in Ruby including while, until, for, break, next, redo, and retry. The while and until loops execute code repeatedly as long as or until a conditional is true. The for loop iterates over each element in an expression. break exits the current loop, next skips to the next iteration, redo restarts the current iteration, and retry restarts the entire loop from the beginning.
The document discusses different conditional statements in Ruby including if/else, unless, case. The if/else statement executes code based on whether a conditional is true or false. Unless executes code if the conditional is false. Case compares an expression to expressions in when clauses using === and executes matching code. Examples are provided for each statement.
Ruby supports single-line comments starting with # and multiline comments using =begin and =end. Single-line comments extend from # to the end of the line. Multiline comments can span multiple lines between =begin and =end tags. Trailing comments should be aligned and separated from code for clarity.
The document summarizes Ruby operators including arithmetic, comparison, assignment, logical, bitwise, range, ternary and defined? operators. It provides examples of common operators like addition, subtraction, logical AND, assignment, range inclusion and method definition checking. Operators in Ruby are generally method calls that allow succinct operation on operands.
The document discusses Ruby classes and objects. It defines a class as a blueprint from which individual objects are created. A class contains data members like attributes and functions/methods. Objects are instances of a class and are created using the new method. The document provides examples of defining a Vehicle class with attributes like wheels, horsepower etc. and methods like speeding, driving. It also discusses creating Customer objects, initializing them using an initialize method, and calling their methods.
The document discusses Ruby syntax including: writing a simple Ruby program with the .rb extension; whitespace and line endings in Ruby programs; Ruby identifiers, reserved words, and comments; here documents for multi-line strings; and the BEGIN and END statements for code execution before and after the main program. Key points are that whitespace is generally ignored, semicolons and newlines end statements, identifiers are case sensitive, reserved words can't be used as names, here documents use line terminators to build strings, and BEGIN and END blocks allow code execution at the start and end of a Ruby program.
This document provides an overview of setting up a Ruby development environment. It discusses installing Ruby on Unix and Windows systems, common command line options, important environment variables, popular Ruby editors like VIM and RubyWin, and how to use the Interactive Ruby shell (IRb) for testing code. The next step outlined is writing initial Ruby programs after confirming a working environment is established.
This document provides an overview and introduction to the Ruby programming language. Ruby is a scripting language designed by Yukihiro Matsumoto that can run on Windows, Mac OS, and UNIX systems. The tutorial is intended for beginners and assumes some basic knowledge of computer programming but no experience with Ruby is required. It provides links to additional reference materials on Ruby including quick references, lists of useful functions and tools, resources for learning Ruby, and tutorials for Ruby on Rails web development.
Ruby is a pure object-oriented programming language created in 1993 by Yukihiro Matsumoto. It has features similar to Smalltalk, Perl, and Python. Ruby is freely available, open-source, and easy to learn. It can be used to create web applications, CGI scripts, and programs that connect to databases. The next chapter will cover obtaining, installing, and setting up Ruby.
Ruby provides mechanisms like begin/rescue/ensure to handle exceptions gracefully. The begin block contains code that could raise exceptions, rescue clauses specify the types of exceptions to handle, and ensure ensures some code is always executed. Exceptions can be raised manually using raise and caught using catch/throw. Common exception classes include StandardError, while custom exceptions should inherit from Exception.
1. O documento é um tutorial de Ruby que ensina sobre a linguagem, incluindo como instalá-la, tipos básicos, estruturas de controle e iteradores.
2. É dividido em seções como instalação, tipos básicos, expressões regulares, arrays, hashes, tratamento de exceções e iteradores.
3. O tutorial é licenciado sob Creative Commons permitindo compartilhamento e modificações desde que creditado e não usado comercialmente.
AI Emotional Actors: “When Machines Learn to Feel and Perform"AkashKumar809858
Welcome to the era of AI Emotional Actors.
The entertainment landscape is undergoing a seismic transformation. What started as motion capture and CGI enhancements has evolved into a full-blown revolution: synthetic beings not only perform but express, emote, and adapt in real time.
For reading further follow this link -
https://akash97.gumroad.com/l/meioex
Cyber Security Legal Framework in Nepal.pptxGhimire B.R.
The presentation is about the review of existing legal framework on Cyber Security in Nepal. The strength and weakness highlights of the major acts and policies so far. Further it highlights the needs of data protection act .
Dev Dives: System-to-system integration with UiPath API WorkflowsUiPathCommunity
Join the next Dev Dives webinar on May 29 for a first contact with UiPath API Workflows, a powerful tool purpose-fit for API integration and data manipulation!
This session will guide you through the technical aspects of automating communication between applications, systems and data sources using API workflows.
📕 We'll delve into:
- How this feature delivers API integration as a first-party concept of the UiPath Platform.
- How to design, implement, and debug API workflows to integrate with your existing systems seamlessly and securely.
- How to optimize your API integrations with runtime built for speed and scalability.
This session is ideal for developers looking to solve API integration use cases with the power of the UiPath Platform.
👨🏫 Speakers:
Gunter De Souter, Sr. Director, Product Manager @UiPath
Ramsay Grove, Product Manager @UiPath
This session streamed live on May 29, 2025, 16:00 CET.
Check out all our upcoming UiPath Dev Dives sessions:
👉 https://community.uipath.com/dev-dives-automation-developer-2025/
Droidal: AI Agents Revolutionizing HealthcareDroidal LLC
Droidal’s AI Agents are transforming healthcare by bringing intelligence, speed, and efficiency to key areas such as Revenue Cycle Management (RCM), clinical operations, and patient engagement. Built specifically for the needs of U.S. hospitals and clinics, Droidal's solutions are designed to improve outcomes and reduce administrative burden.
Through simple visuals and clear examples, the presentation explains how AI Agents can support medical coding, streamline claims processing, manage denials, ensure compliance, and enhance communication between providers and patients. By integrating seamlessly with existing systems, these agents act as digital coworkers that deliver faster reimbursements, reduce errors, and enable teams to focus more on patient care.
Droidal's AI technology is more than just automation — it's a shift toward intelligent healthcare operations that are scalable, secure, and cost-effective. The presentation also offers insights into future developments in AI-driven healthcare, including how continuous learning and agent autonomy will redefine daily workflows.
Whether you're a healthcare administrator, a tech leader, or a provider looking for smarter solutions, this presentation offers a compelling overview of how Droidal’s AI Agents can help your organization achieve operational excellence and better patient outcomes.
A free demo trial is available for those interested in experiencing Droidal’s AI Agents firsthand. Our team will walk you through a live demo tailored to your specific workflows, helping you understand the immediate value and long-term impact of adopting AI in your healthcare environment.
To request a free trial or learn more:
https://droidal.com/
Introducing the OSA 3200 SP and OSA 3250 ePRCAdtran
Adtran's latest Oscilloquartz solutions make optical pumping cesium timing more accessible than ever. Discover how the new OSA 3200 SP and OSA 3250 ePRC deliver superior stability, simplified deployment and lower total cost of ownership. Built on a shared platform and engineered for scalable, future-ready networks, these models are ideal for telecom, defense, metrology and more.
Adtran’s SDG 9000 Series brings high-performance, cloud-managed Wi-Fi 7 to homes, businesses and public spaces. Built on a unified SmartOS platform, the portfolio includes outdoor access points, ceiling-mount APs and a 10G PoE router. Intellifi and Mosaic One simplify deployment, deliver AI-driven insights and unlock powerful new revenue streams for service providers.
Supercharge Your AI Development with Local LLMsFrancesco Corti
In today's AI development landscape, developers face significant challenges when building applications that leverage powerful large language models (LLMs) through SaaS platforms like ChatGPT, Gemini, and others. While these services offer impressive capabilities, they come with substantial costs that can quickly escalate especially during the development lifecycle. Additionally, the inherent latency of web-based APIs creates frustrating bottlenecks during the critical testing and iteration phases of development, slowing down innovation and frustrating developers.
This talk will introduce the transformative approach of integrating local LLMs directly into their development environments. By bringing these models closer to where the code lives, developers can dramatically accelerate development lifecycles while maintaining complete control over model selection and configuration. This methodology effectively reduces costs to zero by eliminating dependency on pay-per-use SaaS services, while opening new possibilities for comprehensive integration testing, rapid prototyping, and specialized use cases.
Marko.js - Unsung Hero of Scalable Web Frameworks (DevDays 2025)Eugene Fidelin
Marko.js is an open-source JavaScript framework created by eBay back in 2014. It offers super-efficient server-side rendering, making it ideal for big e-commerce sites and other multi-page apps where speed and SEO really matter. After over 10 years of development, Marko has some standout features that make it an interesting choice. In this talk, I’ll dive into these unique features and showcase some of Marko's innovative solutions. You might not use Marko.js at your company, but there’s still a lot you can learn from it to bring to your next project.
As data privacy regulations become more pervasive across the globe and organizations increasingly handle and transfer (including across borders) meaningful volumes of personal and confidential information, the need for robust contracts to be in place is more important than ever.
This webinar will provide a deep dive into privacy contracting, covering essential terms and concepts, negotiation strategies, and key practices for managing data privacy risks.
Whether you're in legal, privacy, security, compliance, GRC, procurement, or otherwise, this session will include actionable insights and practical strategies to help you enhance your agreements, reduce risk, and enable your business to move fast while protecting itself.
This webinar will review key aspects and considerations in privacy contracting, including:
- Data processing addenda, cross-border transfer terms including EU Model Clauses/Standard Contractual Clauses, etc.
- Certain legally-required provisions (as well as how to ensure compliance with those provisions)
- Negotiation tactics and common issues
- Recent lessons from recent regulatory actions and disputes
Master tester AI toolbox - Kari Kakkonen at Testaus ja AI 2025 ProfessioKari Kakkonen
My slides at Professio Testaus ja AI 2025 seminar in Espoo, Finland.
Deck in English, even though I talked in Finnish this time, in addition to chairing the event.
I discuss the different motivations for testing to use AI tools to help in testing, and give several examples in each categories, some open source, some commercial.
AI in Java - MCP in Action, Langchain4J-CDI, SmallRye-LLM, Spring AIBuhake Sindi
This is the presentation I gave with regards to AI in Java, and the work that I have been working on. I've showcased Model Context Protocol (MCP) in Java, creating server-side MCP server in Java. I've also introduced Langchain4J-CDI, previously known as SmallRye-LLM, a CDI managed too to inject AI services in enterprise Java applications. Also, honourable mention: Spring AI.
DePIN = Real-World Infra + Blockchain
DePIN stands for Decentralized Physical Infrastructure Networks.
It connects physical devices to Web3 using token incentives.
How Does It Work?
Individuals contribute to infrastructure like:
Wireless networks (e.g., Helium)
Storage (e.g., Filecoin)
Sensors, compute, and energy
They earn tokens for their participation.
GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...James Anderson
The Quantum Apocalypse: A Looming Threat & The Need for Post-Quantum Encryption
We explore the imminent risks posed by quantum computing to modern encryption standards and the urgent need for post-quantum cryptography (PQC).
Bio: With 30 years in cybersecurity, including as a CISO, Tommy is a strategic leader driving security transformation, risk management, and program maturity. He has led high-performing teams, shaped industry policies, and advised organizations on complex cyber, compliance, and data protection challenges.
2. character at a time.
Example:
The output of the following code is just the character H:
#!/usr/bin/ruby
str="Hello Ruby!"
putc str
This will produce following result:
H
The print Statement:
The print statement is similar to the puts statement. The only difference is that the puts statement goes to the next line
after printing the contents, whereas with the print statement the cursor is positioned on the same line.
Example:
#!/usr/bin/ruby
print "Hello World"
print "Good Morning"
This will produce following result:
Hello WorldGood Morning
Opening and Closing Files:
Until now, you have been reading and writing to the standard input and output. Now we will see how to play with actual
data files.
The File.new Method:
You can create a File object using File.new method for reading, writing, or both, according to the mode string. Finally
you can use File.close method to close that file.
Syntax:
aFile = File.new("filename", "mode")
# ... process the file
aFile.close
The File.open Method:
You can use File.open method to create a new file object and assign that file object to a file. However, there is one
difference in between File.open and File.new methods. The difference is that the File.open method can be associated
with a block, whereas you cannot do the same using the File.new method.
File.open("filename", "mode") do |aFile|
# ... process the file
end
3. Here is a list of The Different Modes of Opening a File:
Modes Description
r Read-only mode. The file pointer is placed at the beginning of the file. This is the default mode.
r+ Read-write mode. The file pointer will be at the beginning of the file.
w Write-only mode. Overwrites the file if the file exists. If the file does not exist, creates a new file for
writing.
w+ Read-write mode. Overwrites the existing file if the file exists. If the file does not exist, creates a new file
for reading and writing.
a Write-only mode. The file pointer is at the end of the file if the file exists. That is, the file is in the append
mode. If the file does not exist, it creates a new file for writing.
a+ Read and write mode. The file pointer is at the end of the file if the file exists. The file opens in the
append mode. If the file does not exist, it creates a new file for reading and writing.
Reading and Writing Files:
The same methods that we've been using for 'simple' I/O are available for all file objects. So, gets reads a line from
standard input, and aFile.gets reads a line from the file object aFile.
However, I/O objects provides additional set of access methods to make our lives easier.
The sysread Method:
You can use the method sysread to read the contents of a file. You can open the file in any of the modes when using the
method sysread. For example :
#!/usr/bin/ruby
aFile = File.new("/var/www/tutorialspoint/ruby/test", "r")
if aFile
content = aFile.sysread(20)
puts content
else
puts "Unable to open file!"
end
This statement will output the first 20 characters of the file. The file pointer will now be placed at the 21st character in
the file.
The syswrite Method:
You can use the method syswrite to write the contents into a file. You need to open the file in write mode when using
the method syswrite. For example :
#!/usr/bin/ruby
aFile = File.new("/var/www/tutorialspoint/ruby/test", "r+")
if aFile
aFile.syswrite("ABCDEF")
else
puts "Unable to open file!"
end
4. This statement will write "ABCDEF" into the file.
The each_byte Method:
This method belongs to the class File. The method each_byte is always associated with a block. Consider the following
code sample: :
#!/usr/bin/ruby
aFile = File.new("/var/www/tutorialspoint/ruby/test", "r")
if aFile
aFile.syswrite("ABCDEF")
aFile.each_byte {|ch| putc ch; putc ?. }
else
puts "Unable to open file!"
end
Characters are passed one by one to the variable ch and then displayed on the screen as follows:
T.h.i.s. .i.s. .l.i.n.e. .o.n.e.
.T.h.i.s. .i.s. .l.i.n.e. .t.w.o.
.T.h.i.s. .i.s. .l.i.n.e. .t.h.r.e.e.
.A.n.d. .s.o. .o.n.......
The IO.readlines Method:
The class File is a subclass of the class IO. The class IO also has some methods which can be used to manipulate files.
One of the IO class methods is IO.readlines. This method returns the contents of the file line by line. The following
code displays the use of the method IO.readlines:
#!/usr/bin/ruby
arr = IO.readlines("/var/www/tutorialspoint/ruby/test")
puts arr[0]
puts arr[1]
In this code, the variable arr is an array. Each line of the file test will be an element in the array arr. Therefore, arr[0]
will contain the first line, whereas arr[1] will contain the second line of the file.
The IO.foreach Method:
This method also returns output line by line. The difference between the method foreach and the method readlines is
that the method foreach is associated with a block. However, unlike the method readlines, the method foreach does not
return an array. For example:
#!/usr/bin/ruby
IO.foreach("test"){|block| puts block}
This code will pass the contents of the file test line by line to the variable block, and then the output will be displayed
on the screen.
Renaming and Deleting Files:
You can rename and delete files programmatically with Ruby with the rename and delete methods.
Following is the example to rename an existing file test1.txt:
5. #!/usr/bin/ruby
# Rename a file from test1.txt to test2.txt
File.rename( "test1.txt", "test2.txt" )
Following is the example to delete an existing file test2.txt:
#!/usr/bin/ruby
# Delete file test2.txt
File.delete("text2.txt")
File Modes and Ownership:
Use the chmod method with a mask to change the mode or permissions/access list of a file:
Following is the example to change mode of an existing file test.txt to a mask value:
#!/usr/bin/ruby
file = File.new( "test.txt", "w" )
file.chmod( 0755 )
Following is the table which can help you to choose different mask for chmod method:
Mask Description
0700 rwx mask for owner
0400 r for owner
0200 w for owner
0100 x for owner
0070 rwx mask for group
0040 r for group
0020 w for group
0010 x for group
0007 rwx mask for other
0004 r for other
0002 w for other
0001 x for other
4000 Set user ID on execution
2000 Set group ID on execution
1000 Save swapped text, even after use
6. File Inquiries:
The following command tests whether a file exists before opening it:
#!/usr/bin/ruby
File.open("file.rb") if File::exists?( "file.rb" )
The following command inquire whether the file is really a file:
#!/usr/bin/ruby
# This returns either true or false
File.file?( "text.txt" )
The following command finds out if it given file name is a directory:
#!/usr/bin/ruby
# a directory
File::directory?( "/usr/local/bin" ) # => true
# a file
File::directory?( "file.rb" ) # => false
The following command finds whether the file is readable, writable or executable:
#!/usr/bin/ruby
File.readable?( "test.txt" ) # => true
File.writable?( "test.txt" ) # => true
File.executable?( "test.txt" ) # => false
The following command finds whether the file has zero size or not:
#!/usr/bin/ruby
File.zero?( "test.txt" ) # => true
The following command returns size of the file :
#!/usr/bin/ruby
File.size?( "text.txt" ) # => 1002
The following command can be used to find out a type of file :
#!/usr/bin/ruby
File::ftype( "test.txt" ) # => file
The ftype method identifies the type of the file by returning one of the following: file, directory, characterSpecial,
blockSpecial, fifo, link, socket, or unknown.
The following command can be used to find when a file was created, modified, or last accessed :
#!/usr/bin/ruby
File::ctime( "test.txt" ) # => Fri May 09 10:06:37 -0700 2008
File::mtime( "text.txt" ) # => Fri May 09 10:44:44 -0700 2008
File::atime( "text.txt" ) # => Fri May 09 10:45:01 -0700 2008
7. Directories in Ruby:
All files are contained within various directories, and Ruby has no problem handling these too. Whereas the File class
handles files, directories are handled with the Dir class.
Navigating Through Directories:
To change directory within a Ruby program, use Dir.chdir as follows. This example changes the current directory to
/usr/bin.
Dir.chdir("/usr/bin")
You can find out what the current directory is with Dir.pwd:
puts Dir.pwd # This will return something like /usr/bin
You can get a list of the files and directories within a specific directory using Dir.entries:
puts Dir.entries("/usr/bin").join(' ')
Dir.entries returns an array with all the entries within the specified directory. Dir.foreach provides the same feature:
Dir.foreach("/usr/bin") do |entry|
puts entry
end
An even more concise way of getting directory listings is by using Dir's class array method:
Dir["/usr/bin/*"]
Creating a Directory:
The Dir.mkdir can be used to create directories:
Dir.mkdir("mynewdir")
You can also set permissions on a new directory (not one that already exists) with mkdir:
NOTE: The mask 755 sets permissions owner, group, world [anyone] to rwxr-xr-x where r = read, w = write, and x =
execute.
Dir.mkdir( "mynewdir", 755 )
Deleting a Directory:
The Dir.delete can be used to delete a directory. The Dir.unlink and Dir.rmdir perform exactly the same function and
are provided for convenience.
Dir.delete("testdir")
Creating Files & Temporary Directories:
Temporary files are those that might be created briefly during a program's execution but aren't a permanent store of
information.
8. Dir.tmpdir provides the path to the temporary directory on the current system, although the method is not available by
default. To make Dir.tmpdir available it's necessary to use require 'tmpdir'.
You can use Dir.tmpdir with File.join to create a platform-independent temporary file:
require 'tmpdir'
tempfilename = File.join(Dir.tmpdir, "tingtong")
tempfile = File.new(tempfilename, "w")
tempfile.puts "This is a temporary file"
tempfile.close
File.delete(tempfilename)
This code creates a temporary file, writes data to it, and deletes it. Ruby's standard library also includes a library called
Tempfile that can create temporary files for you:
require 'tempfile'
f = Tempfile.new('tingtong')
f.puts "Hello"
puts f.path
f.close
Built-in Functions:
Here is the complete list of ruby buil-in functions to process files and directories:
File Class and Methods.
Dir Class and Methods.