This technical talk introduces Ruby as a programming language. It provides an overview of Ruby's history, basic features, and differences from other languages like Java and PHP. The document also discusses Ruby on Rails, meta programming in Ruby, and resources for learning Ruby.
Ruby Programming Language - IntroductionKwangshin Oh
Ruby is an interpreted, object-oriented, and dynamically typed programming language. It was created in the 1990s by Yukihiro Matsumoto to enhance programmer productivity and have fun. Some key aspects include everything being an object, duck typing where objects are identified by their methods/attributes rather than type, and a focus on simplicity, readability, and productivity for programmers.
Ruby on Rails is a popular web application framework written in Ruby. It follows the model-view-controller (MVC) pattern and includes components like Action Pack, Active Support, Active Record, and Action Mailer. The document provides an overview of Rails, Ruby basics, installing Rails, the directory structure of a Rails application, and the MVC pattern.
Whitebox testing of Spring Boot applicationsYura Nosenko
This document discusses whitebox testing of Spring Boot applications. It begins with introductions and backgrounds, then discusses issues with existing testing frameworks like TestNG and JUnit 4. It proposes alternatives like Spock and JUnit 5, highlighting advantages of each. It also provides an overview of Spring Boot testing capabilities, focusing on integration testing support, transaction handling, main components, and reactive support. It concludes with examples of setting up Spring Boot testing with Spock and JUnit 5.
A quick introduction to the object-oriented programming language Ruby, part of a full lecture on Programming Paradigms at UCL university in Belgium, focussing on the programming languages Smalltalk, Ruby and Java, with reflection and meta programming as underlying theme.
Array Basics
Copying Arrays
Passing Arrays to Methods
Returning an Array from a Method
(Optional) Variable-Length Argument Lists
The Arrays Class
Two-Dimensional Arrays
(Optional) Multidimensional Arrays
JavaScript - An Introduction is a beginner's guide to JavaScript. It starts with very basic level and goes to intermediate level. You'll be introduced with every language constructs, Event handling, Form handling and AJAX which is supported by JavaScript with XMLHttpRequest object. This XHR object is discussed in enough detail so that you can understand how the underlying AJAX functionality works in jQuery. At the end it discusses advance concepts and library build on/around JavaScript.
This document discusses the core concepts of object-oriented programming (OOP) in Java, including inheritance, encapsulation, abstraction, and polymorphism. It provides examples of each concept: inheritance allows classes to inherit properties from parent classes; encapsulation involves hiding data and code together within classes; abstraction deals with hiding details and focusing on essentials through abstract classes and interfaces; polymorphism allows classes to take different forms. The document uses examples like vehicles and medical capsules to illustrate how each OOP concept works in Java code.
Java Serialization is often considered a dark art of Java programmers. This session will lift the veil and show what serialization is and isn't, how you can use it for profit and evil. After this session no NotSerializableException will be unconquerable.
The presentation given at MSBTE sponsored content updating program on 'Advanced Java Programming' for Diploma Engineering teachers of Maharashtra. Venue: Guru Gobind Singh Polytechnic, Nashik
Date: 22/12/2010
Session: Java Network Programming
Achievers IT React JS Certification Course in Bangalore. ... UI Development training in Marathahalli ; also benefits as UI training online and UI Developer
This document provides an overview of the Ruby programming language. It introduces basic Ruby concepts like variables, data types, flow control, classes and objects. It also discusses tools and frameworks like Rails, gems, and testing. The document encourages learning Ruby and provides resources to get started, including trying an interactive tutorial and installing a development environment. It emphasizes that Ruby is fun and easy to learn.
This is a beginner's guide to Java 8 Lambdas, accompnied with executable code examples which you can find at https://github.com/manvendrasinghkadam/java8streams. Java 8 Streams are based on Lambdas, so this presentation assumes you know Lambdas quite well. If don't then please let me know I'll create another presentation regarding it with code examples. Lambdas are relatively easy to use and with the power of stream api you can do functional programming in Java right from start. This is very cool to be a Java programmer now.
Automating security test using Selenium and OWASP ZAP - Practical DevSecOpsMohammed A. Imran
In Practical DevSecOps - DevSecOps Live online meetup, you’ll learn Automating security tests using Selenium and OWASP ZAP.
Join Srinivas, Red Team Member at Banking Industry, also Offensive Security Certified Professional(OSCP) and Offensive Security Certified Expert(OSCE.
He will cover Automating security tests using Selenium and OWASP ZAP.
In this intriguing meetup, you will learn:
1. Introduction to automated vulnerability scans and their limitations.
2. A short introduction to how functional tests can be useful in performing robust security tests.
3. Introduction to selenium and OWASP ZAP
4. Proxying selenium tests through OWASP ZAP
5. Invoking authenticated active scans using OWASP ZAP
6. Obtaining scan reports
… and more useful takeaways!
Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object. Any Java object that can pass more than one IS-A test is considered to be polymorphic.
This document provides tips and tricks for using Burp Suite Pro. It discusses how to optimize the Proxy history and Repeater tools to avoid scrolling and easily identify request sequences. It also covers using built-in wordlists and placeholders in the Intruder tool and how HTTP interactions in the Collaborator tool do not require using its domain name. The document demonstrates transformers in the Hackvertor extension and how the Piper extension can execute external tools from within Burp. It concludes with suggestions for using keyboard shortcuts, poor-man automation techniques, optimizing performance, and staying up to date on Burp Suite developments.
The document provides an overview of Tomcat and JBoss, open-source servlet containers. It discusses the origins and frameworks of Tomcat and JBoss, how to get started with Tomcat configuration, deployment, security, and load balancing of Tomcat instances with Apache HTTP Server. Key configuration files for Tomcat are also summarized.
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016Christian Schneider
The hidden danger of Java deserialization vulnerabilities – which often lead to remote code execution – has gained extended visibility in the past year. The issue has been known for years; however, it seems that the majority of developers were unaware of it until recent media coverage around commonly used libraries and major products. This talk aims to shed some light about how this vulnerability can be abused, how to detect it from a static and dynamic point of view, and -- most importantly -- how to effectively protect against it. The scope of this talk is not limited to the Java serialization protocol but also other popular Java libraries used for object serialization.
The ever-increasing number of new vulnerable endpoints and attacker-usable gadgets has resulted in a lot of different recommendations on how to protect your applications, including look-ahead deserialization and runtime agents to monitor and protect the deserialization process. Coming at the problem from a developer’s perspective and triaging the recommendations for you, this talk will review existing protection techniques and demonstrate their effectiveness on real applications. It will also review existing techniques and present new gadgets that demonstrates how attackers can actually abuse your application code and classpath to craft a chain of gadgets that will allow them to compromise your servers.
This talk will also present the typical architectural decisions and code patterns that lead to an increased risk of exposing deserialization vulnerabilities. Mapping the typical anti-patterns that must be avoided, through the use of real code examples we present an overview of hardening techniques and their effectiveness. The talk will also show attendees what to search the code for in order to find potential code gadgets the attackers can leverage to compromise their applications. We’ll conclude with action items and recommendations developers should consider to mitigate this threat.
--
This talk was presented by Alvaro Muñoz & Christian Schneider at the OWASP AppSecEU 2016 conference in Rome.
The document discusses various techniques for software testing, including:
- White-box testing techniques like control flow-based testing which aims to cover all statements, branches, and paths in the code. Data flow-based testing which aims to cover all def-use pairs to test variable definitions and uses.
- Black-box testing techniques like equivalence partitioning which partitions input/output domains into equivalence classes and tests using values from different classes.
- The benefits of testing include finding bugs, improving quality, and ensuring software meets specifications despite inevitable faults. Thorough testing can help reduce risks even if perfect testing is impossible.
The document discusses several object-oriented (OO) design principles including the single responsibility principle (SRP), open-closed principle (OCP), Liskov substitution principle (LSP), interface segregation principle (ISP), and dependency inversion principle (DIP). It also discusses design patterns, refactoring, and design by contract (DBC) as ways to prevent software decay over time and improve design quality. The key OO principles guide developers to create flexible, maintainable and reusable software designs.
Inheritance allows classes to inherit and extend the functionality of existing classes without modifying them, creating a hierarchical relationship. There are different types of inheritance like single, multilevel, multiple and hybrid inheritance. The visibility modifier (public, private, protected) determines which members are accessible to derived classes. Virtual base classes avoid duplicate members when multiple inheritance paths exist to a common base class.
Ajax (Asynchronous JavaScript and XML) est une technique permettant la communication asynchrone entre application et serveur. c'est une architecture qui permet de construire des applications Web et des sites web dynamiques interactifs sur le poste client en se servant de différentes technologies.
Ajax combine JavaScript, les CSS, XML, le DOM et le XMLHttpRequest afin d'améliorer maniabilité et confort d'utilisation des Applications Internet Riches
Advanced Topics On Sql Injection Protectionamiable_indian
The document discusses various methods for preventing SQL injection attacks, including input validation, using static query statements, and least privilege approaches. It provides detailed explanations and examples of how to properly implement input validation, including escaping special characters, validating numeric fields, and preventing second-order SQL injection. The document also cautions that approaches like parameterized statements and stored procedures do not automatically prevent SQL injection and can still be vulnerable if not implemented correctly.
Este documento describe algoritmos de búsqueda como backtracking y branch and bound. Explica que estos algoritmos realizan una búsqueda exhaustiva y sistemática en el espacio de soluciones de un problema. También describe cómo estos algoritmos pueden implementarse de forma paralela para reducir el tiempo de ejecución. En particular, se enfoca en técnicas como la asignación estática y dinámica del trabajo entre procesadores y esquemas para balancear la carga de trabajo.
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.
This document summarizes common Ruby "gotchas", or unexpected behaviors that can trip up developers. It covers topics like string interpolation requiring double quotes, truthiness of values other than false and nil, differences between symbols and strings, accessing characters in strings, variable scope in blocks, freezing arrays, and initializing arrays and hashes with the same object. The goal is to explain behaviors that may surprise those from other languages and help developers avoid potential pitfalls.
JavaScript - An Introduction is a beginner's guide to JavaScript. It starts with very basic level and goes to intermediate level. You'll be introduced with every language constructs, Event handling, Form handling and AJAX which is supported by JavaScript with XMLHttpRequest object. This XHR object is discussed in enough detail so that you can understand how the underlying AJAX functionality works in jQuery. At the end it discusses advance concepts and library build on/around JavaScript.
This document discusses the core concepts of object-oriented programming (OOP) in Java, including inheritance, encapsulation, abstraction, and polymorphism. It provides examples of each concept: inheritance allows classes to inherit properties from parent classes; encapsulation involves hiding data and code together within classes; abstraction deals with hiding details and focusing on essentials through abstract classes and interfaces; polymorphism allows classes to take different forms. The document uses examples like vehicles and medical capsules to illustrate how each OOP concept works in Java code.
Java Serialization is often considered a dark art of Java programmers. This session will lift the veil and show what serialization is and isn't, how you can use it for profit and evil. After this session no NotSerializableException will be unconquerable.
The presentation given at MSBTE sponsored content updating program on 'Advanced Java Programming' for Diploma Engineering teachers of Maharashtra. Venue: Guru Gobind Singh Polytechnic, Nashik
Date: 22/12/2010
Session: Java Network Programming
Achievers IT React JS Certification Course in Bangalore. ... UI Development training in Marathahalli ; also benefits as UI training online and UI Developer
This document provides an overview of the Ruby programming language. It introduces basic Ruby concepts like variables, data types, flow control, classes and objects. It also discusses tools and frameworks like Rails, gems, and testing. The document encourages learning Ruby and provides resources to get started, including trying an interactive tutorial and installing a development environment. It emphasizes that Ruby is fun and easy to learn.
This is a beginner's guide to Java 8 Lambdas, accompnied with executable code examples which you can find at https://github.com/manvendrasinghkadam/java8streams. Java 8 Streams are based on Lambdas, so this presentation assumes you know Lambdas quite well. If don't then please let me know I'll create another presentation regarding it with code examples. Lambdas are relatively easy to use and with the power of stream api you can do functional programming in Java right from start. This is very cool to be a Java programmer now.
Automating security test using Selenium and OWASP ZAP - Practical DevSecOpsMohammed A. Imran
In Practical DevSecOps - DevSecOps Live online meetup, you’ll learn Automating security tests using Selenium and OWASP ZAP.
Join Srinivas, Red Team Member at Banking Industry, also Offensive Security Certified Professional(OSCP) and Offensive Security Certified Expert(OSCE.
He will cover Automating security tests using Selenium and OWASP ZAP.
In this intriguing meetup, you will learn:
1. Introduction to automated vulnerability scans and their limitations.
2. A short introduction to how functional tests can be useful in performing robust security tests.
3. Introduction to selenium and OWASP ZAP
4. Proxying selenium tests through OWASP ZAP
5. Invoking authenticated active scans using OWASP ZAP
6. Obtaining scan reports
… and more useful takeaways!
Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object. Any Java object that can pass more than one IS-A test is considered to be polymorphic.
This document provides tips and tricks for using Burp Suite Pro. It discusses how to optimize the Proxy history and Repeater tools to avoid scrolling and easily identify request sequences. It also covers using built-in wordlists and placeholders in the Intruder tool and how HTTP interactions in the Collaborator tool do not require using its domain name. The document demonstrates transformers in the Hackvertor extension and how the Piper extension can execute external tools from within Burp. It concludes with suggestions for using keyboard shortcuts, poor-man automation techniques, optimizing performance, and staying up to date on Burp Suite developments.
The document provides an overview of Tomcat and JBoss, open-source servlet containers. It discusses the origins and frameworks of Tomcat and JBoss, how to get started with Tomcat configuration, deployment, security, and load balancing of Tomcat instances with Apache HTTP Server. Key configuration files for Tomcat are also summarized.
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016Christian Schneider
The hidden danger of Java deserialization vulnerabilities – which often lead to remote code execution – has gained extended visibility in the past year. The issue has been known for years; however, it seems that the majority of developers were unaware of it until recent media coverage around commonly used libraries and major products. This talk aims to shed some light about how this vulnerability can be abused, how to detect it from a static and dynamic point of view, and -- most importantly -- how to effectively protect against it. The scope of this talk is not limited to the Java serialization protocol but also other popular Java libraries used for object serialization.
The ever-increasing number of new vulnerable endpoints and attacker-usable gadgets has resulted in a lot of different recommendations on how to protect your applications, including look-ahead deserialization and runtime agents to monitor and protect the deserialization process. Coming at the problem from a developer’s perspective and triaging the recommendations for you, this talk will review existing protection techniques and demonstrate their effectiveness on real applications. It will also review existing techniques and present new gadgets that demonstrates how attackers can actually abuse your application code and classpath to craft a chain of gadgets that will allow them to compromise your servers.
This talk will also present the typical architectural decisions and code patterns that lead to an increased risk of exposing deserialization vulnerabilities. Mapping the typical anti-patterns that must be avoided, through the use of real code examples we present an overview of hardening techniques and their effectiveness. The talk will also show attendees what to search the code for in order to find potential code gadgets the attackers can leverage to compromise their applications. We’ll conclude with action items and recommendations developers should consider to mitigate this threat.
--
This talk was presented by Alvaro Muñoz & Christian Schneider at the OWASP AppSecEU 2016 conference in Rome.
The document discusses various techniques for software testing, including:
- White-box testing techniques like control flow-based testing which aims to cover all statements, branches, and paths in the code. Data flow-based testing which aims to cover all def-use pairs to test variable definitions and uses.
- Black-box testing techniques like equivalence partitioning which partitions input/output domains into equivalence classes and tests using values from different classes.
- The benefits of testing include finding bugs, improving quality, and ensuring software meets specifications despite inevitable faults. Thorough testing can help reduce risks even if perfect testing is impossible.
The document discusses several object-oriented (OO) design principles including the single responsibility principle (SRP), open-closed principle (OCP), Liskov substitution principle (LSP), interface segregation principle (ISP), and dependency inversion principle (DIP). It also discusses design patterns, refactoring, and design by contract (DBC) as ways to prevent software decay over time and improve design quality. The key OO principles guide developers to create flexible, maintainable and reusable software designs.
Inheritance allows classes to inherit and extend the functionality of existing classes without modifying them, creating a hierarchical relationship. There are different types of inheritance like single, multilevel, multiple and hybrid inheritance. The visibility modifier (public, private, protected) determines which members are accessible to derived classes. Virtual base classes avoid duplicate members when multiple inheritance paths exist to a common base class.
Ajax (Asynchronous JavaScript and XML) est une technique permettant la communication asynchrone entre application et serveur. c'est une architecture qui permet de construire des applications Web et des sites web dynamiques interactifs sur le poste client en se servant de différentes technologies.
Ajax combine JavaScript, les CSS, XML, le DOM et le XMLHttpRequest afin d'améliorer maniabilité et confort d'utilisation des Applications Internet Riches
Advanced Topics On Sql Injection Protectionamiable_indian
The document discusses various methods for preventing SQL injection attacks, including input validation, using static query statements, and least privilege approaches. It provides detailed explanations and examples of how to properly implement input validation, including escaping special characters, validating numeric fields, and preventing second-order SQL injection. The document also cautions that approaches like parameterized statements and stored procedures do not automatically prevent SQL injection and can still be vulnerable if not implemented correctly.
Este documento describe algoritmos de búsqueda como backtracking y branch and bound. Explica que estos algoritmos realizan una búsqueda exhaustiva y sistemática en el espacio de soluciones de un problema. También describe cómo estos algoritmos pueden implementarse de forma paralela para reducir el tiempo de ejecución. En particular, se enfoca en técnicas como la asignación estática y dinámica del trabajo entre procesadores y esquemas para balancear la carga de trabajo.
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.
This document summarizes common Ruby "gotchas", or unexpected behaviors that can trip up developers. It covers topics like string interpolation requiring double quotes, truthiness of values other than false and nil, differences between symbols and strings, accessing characters in strings, variable scope in blocks, freezing arrays, and initializing arrays and hashes with the same object. The goal is to explain behaviors that may surprise those from other languages and help developers avoid potential pitfalls.
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
Groovy is a dynamic language for the Java Virtual Machine that aims to bring dynamic capabilities like Python and Ruby to Java developers. It has many features inspired by dynamic languages like closures, duck typing and metaprogramming, but also maintains compatibility with Java by having a Java-like syntax and the ability to interoperate with Java code. Groovy code can either be run directly from scripts or compiled into Java bytecode to be used within Java applications.
The document provides an overview of the Ruby programming language, including its goals, contents, key features like object oriented programming and metaprogramming. It covers Ruby statements, data types, classes, modules, inheritance, exceptions handling, and how to dynamically modify classes and objects through metaprogramming.
Code for Startup MVP (Ruby on Rails) Session 2Henry S
This document provides an overview and agenda for a workshop on learning to code for startup MVPs using Ruby on Rails. It covers setting up the development environment, a review of concepts from the previous session, and a focus on Ruby basics, Rails models, and using Devise for user authentication.
This document provides an introduction to Perl programming by discussing what Perl is used for, why it is useful, and how to get started with the language. It covers installing Perl on Windows and Linux, using variables and data structures like scalars, arrays, hashes, and references. It also demonstrates basic Perl syntax like conditional statements, loops, file I/O, and running commands. The goal is to get readers writing basic Perl code quickly while highlighting some key features of the language.
The slides for a lecture about the Ruby programming language. This language was given at FEUP, on a course called "Laboratories of Object-Oriented Programming".
The document summarizes basic concepts from Mr. Neighborly's Humble Little Ruby Book, including:
- What Ruby is and why learn it (a programming language and Ruby on Rails uses Ruby)
- Features that make Ruby special like object-oriented, interpreted, and automatic garbage collection
- Basic data types in Ruby like integers, floats, strings, arrays, hashes, ranges, and symbols
- How to define and manipulate various data types
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.
This document provides an overview of the Ruby programming language. It discusses that Ruby is an object-oriented scripting language created in 1993. It describes some key features of Ruby including being open-source, having a clean syntax, and being able to connect to databases. The document then covers various Ruby programming concepts such as classes, objects, variables, containers, blocks, iterators, and standard data types like numbers, strings, and ranges. It provides examples to illustrate how to use these Ruby features.
Ruby is an object-oriented scripting language that is dynamically typed and supports duck typing. It was created in the 1990s by Yukihiro "Matz" Matsumoto and has gained popularity through its use in web frameworks like Ruby on Rails. This document provides an overview of the Ruby language, including its history, basic syntax like strings and methods, core data types, control structures, classes and inheritance. It also discusses tools used by Ruby developers like RubyGems, interactive Ruby shells, and practical applications of Ruby for web development, testing, and automation through scripting. Finally, it mentions the international Ruby community and local user groups.
This document provides an overview of Python's basic data types and operations. It discusses numbers, strings, booleans, lists, tuples, and dictionaries. For each type, it demonstrates how to initialize, access, modify, and compare values. Some key points covered include Python's dynamic typing, built-in functions like len() and print(), slicing lists and strings, and unpacking tuples into variables. The document is intended to teach Python fundamentals in a clear and approachable manner.
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 a dynamic, open source object-oriented scripting language that is interpreted, not compiled. It supports features like garbage collection, exception handling, operator overloading, and just-in-time compilation. Ruby can be used for web development, system scripting, database programming, and GUI development. It uses classes and modules to support object-oriented programming concepts like inheritance, polymorphism, and mixins.
Slides from the Ruby Topic Maps Tutorial I gave at TMRA in October 2007. New upload for new RTM website: http://rtm.topicmapslab.de
This document provides an overview of some new features and enhancements in Ruby 2.0, including refinements, Module#prepend, keyword arguments, lazy enumerables, %i and %I symbol literals, default UTF-8 encoding, Struct#to_h, respond_to? limitations for protected methods, and require optimizations.
Ruby is a dynamic, open source programming language that is interpreted, object-oriented, and functional. It focuses on simplicity and emphasizes programmer productivity. Ruby on Rails is a web application framework built on Ruby that follows the model-view-controller architectural pattern. It aims to make web development faster and easier through its conventions, including generating scaffolding for basic CRUD operations on models.
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.
For a demo to some colleagues, I created a Ruby on Rails demonstration. This presentation is used to show concepts, and illustrate the case. See http://changelos.com/2010/06/08/demoing-ruby-on-rails/ for the full story.
AgentExchange is Salesforce’s latest innovation, expanding upon the foundation of AppExchange by offering a centralized marketplace for AI-powered digital labor. Designed for Agentblazers, developers, and Salesforce admins, this platform enables the rapid development and deployment of AI agents across industries.
Email: [email protected]
Phone: +1(630) 349 2411
Website: https://www.fexle.com/blogs/agentexchange-an-ultimate-guide-for-salesforce-consultants-businesses/?utm_source=slideshare&utm_medium=pptNg
Avast Premium Security Crack FREE Latest Version 2025mu394968
🌍📱👉COPY LINK & PASTE ON GOOGLE https://dr-kain-geera.info/👈🌍
Avast Premium Security is a paid subscription service that provides comprehensive online security and privacy protection for multiple devices. It includes features like antivirus, firewall, ransomware protection, and website scanning, all designed to safeguard against a wide range of online threats, according to Avast.
Key features of Avast Premium Security:
Antivirus: Protects against viruses, malware, and other malicious software, according to Avast.
Firewall: Controls network traffic and blocks unauthorized access to your devices, as noted by All About Cookies.
Ransomware protection: Helps prevent ransomware attacks, which can encrypt your files and hold them hostage.
Website scanning: Checks websites for malicious content before you visit them, according to Avast.
Email Guardian: Scans your emails for suspicious attachments and phishing attempts.
Multi-device protection: Covers up to 10 devices, including Windows, Mac, Android, and iOS, as stated by 2GO Software.
Privacy features: Helps protect your personal data and online privacy.
In essence, Avast Premium Security provides a robust suite of tools to keep your devices and online activity safe and secure, according to Avast.
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?steaveroggers
Migrating from Lotus Notes to Outlook can be a complex and time-consuming task, especially when dealing with large volumes of NSF emails. This presentation provides a complete guide on how to batch export Lotus Notes NSF emails to Outlook PST format quickly and securely. It highlights the challenges of manual methods, the benefits of using an automated tool, and introduces eSoftTools NSF to PST Converter Software — a reliable solution designed to handle bulk email migrations efficiently. Learn about the software’s key features, step-by-step export process, system requirements, and how it ensures 100% data accuracy and folder structure preservation during migration. Make your email transition smoother, safer, and faster with the right approach.
Read More:- https://www.esofttools.com/nsf-to-pst-converter.html
Adobe Lightroom Classic Crack FREE Latest link 2025kashifyounis067
🌍📱👉COPY LINK & PASTE ON GOOGLE http://drfiles.net/ 👈🌍
Adobe Lightroom Classic is a desktop-based software application for editing and managing digital photos. It focuses on providing users with a powerful and comprehensive set of tools for organizing, editing, and processing their images on their computer. Unlike the newer Lightroom, which is cloud-based, Lightroom Classic stores photos locally on your computer and offers a more traditional workflow for professional photographers.
Here's a more detailed breakdown:
Key Features and Functions:
Organization:
Lightroom Classic provides robust tools for organizing your photos, including creating collections, using keywords, flags, and color labels.
Editing:
It offers a wide range of editing tools for making adjustments to color, tone, and more.
Processing:
Lightroom Classic can process RAW files, allowing for significant adjustments and fine-tuning of images.
Desktop-Focused:
The application is designed to be used on a computer, with the original photos stored locally on the hard drive.
Non-Destructive Editing:
Edits are applied to the original photos in a non-destructive way, meaning the original files remain untouched.
Key Differences from Lightroom (Cloud-Based):
Storage Location:
Lightroom Classic stores photos locally on your computer, while Lightroom stores them in the cloud.
Workflow:
Lightroom Classic is designed for a desktop workflow, while Lightroom is designed for a cloud-based workflow.
Connectivity:
Lightroom Classic can be used offline, while Lightroom requires an internet connection to sync and access photos.
Organization:
Lightroom Classic offers more advanced organization features like Collections and Keywords.
Who is it for?
Professional Photographers:
PCMag notes that Lightroom Classic is a popular choice among professional photographers who need the flexibility and control of a desktop-based application.
Users with Large Collections:
Those with extensive photo collections may prefer Lightroom Classic's local storage and robust organization features.
Users who prefer a traditional workflow:
Users who prefer a more traditional desktop workflow, with their original photos stored on their computer, will find Lightroom Classic a good fit.
Who Watches the Watchmen (SciFiDevCon 2025)Allon Mureinik
Tests, especially unit tests, are the developers’ superheroes. They allow us to mess around with our code and keep us safe.
We often trust them with the safety of our codebase, but how do we know that we should? How do we know that this trust is well-deserved?
Enter mutation testing – by intentionally injecting harmful mutations into our code and seeing if they are caught by the tests, we can evaluate the quality of the safety net they provide. By watching the watchmen, we can make sure our tests really protect us, and we aren’t just green-washing our IDEs to a false sense of security.
Talk from SciFiDevCon 2025
https://www.scifidevcon.com/courses/2025-scifidevcon/contents/680efa43ae4f5
WinRAR Crack for Windows (100% Working 2025)sh607827
copy and past on google ➤ ➤➤ https://hdlicense.org/ddl/
WinRAR Crack Free Download is a powerful archive manager that provides full support for RAR and ZIP archives and decompresses CAB, ARJ, LZH, TAR, GZ, ACE, UUE, .
F-Secure Freedome VPN 2025 Crack Plus Activation New Versionsaimabibi60507
Copy & Past Link 👉👉
https://dr-up-community.info/
F-Secure Freedome VPN is a virtual private network service developed by F-Secure, a Finnish cybersecurity company. It offers features such as Wi-Fi protection, IP address masking, browsing protection, and a kill switch to enhance online privacy and security .
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentShubham Joshi
A secure test infrastructure ensures that the testing process doesn’t become a gateway for vulnerabilities. By protecting test environments, data, and access points, organizations can confidently develop and deploy software without compromising user privacy or system integrity.
Exploring Wayland: A Modern Display Server for the FutureICS
Wayland is revolutionizing the way we interact with graphical interfaces, offering a modern alternative to the X Window System. In this webinar, we’ll delve into the architecture and benefits of Wayland, including its streamlined design, enhanced performance, and improved security features.
Adobe After Effects Crack FREE FRESH version 2025kashifyounis067
🌍📱👉COPY LINK & PASTE ON GOOGLE http://drfiles.net/ 👈🌍
Adobe After Effects is a software application used for creating motion graphics, special effects, and video compositing. It's widely used in TV and film post-production, as well as for creating visuals for online content, presentations, and more. While it can be used to create basic animations and designs, its primary strength lies in adding visual effects and motion to videos and graphics after they have been edited.
Here's a more detailed breakdown:
Motion Graphics:
.
After Effects is powerful for creating animated titles, transitions, and other visual elements to enhance the look of videos and presentations.
Visual Effects:
.
It's used extensively in film and television for creating special effects like green screen compositing, object manipulation, and other visual enhancements.
Video Compositing:
.
After Effects allows users to combine multiple video clips, images, and graphics to create a final, cohesive visual.
Animation:
.
It uses keyframes to create smooth, animated sequences, allowing for precise control over the movement and appearance of objects.
Integration with Adobe Creative Cloud:
.
After Effects is part of the Adobe Creative Cloud, a suite of software that includes other popular applications like Photoshop and Premiere Pro.
Post-Production Tool:
.
After Effects is primarily used in the post-production phase, meaning it's used to enhance the visuals after the initial editing of footage has been completed.
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AIdanshalev
If we were building a GenAI stack today, we'd start with one question: Can your retrieval system handle multi-hop logic?
Trick question, b/c most can’t. They treat retrieval as nearest-neighbor search.
Today, we discussed scaling #GraphRAG at AWS DevOps Day, and the takeaway is clear: VectorRAG is naive, lacks domain awareness, and can’t handle full dataset retrieval.
GraphRAG builds a knowledge graph from source documents, allowing for a deeper understanding of the data + higher accuracy.
Discover why Wi-Fi 7 is set to transform wireless networking and how Router Architects is leading the way with next-gen router designs built for speed, reliability, and innovation.
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)Andre Hora
Software testing plays a crucial role in the contribution process of open-source projects. For example, contributions introducing new features are expected to include tests, and contributions with tests are more likely to be accepted. Although most real-world projects require contributors to write tests, the specific testing practices communicated to contributors remain unclear. In this paper, we present an empirical study to understand better how software testing is approached in contribution guidelines. We analyze the guidelines of 200 Python and JavaScript open-source software projects. We find that 78% of the projects include some form of test documentation for contributors. Test documentation is located in multiple sources, including CONTRIBUTING files (58%), external documentation (24%), and README files (8%). Furthermore, test documentation commonly explains how to run tests (83.5%), but less often provides guidance on how to write tests (37%). It frequently covers unit tests (71%), but rarely addresses integration (20.5%) and end-to-end tests (15.5%). Other key testing aspects are also less frequently discussed: test coverage (25.5%) and mocking (9.5%). We conclude by discussing implications and future research.
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Ranjan Baisak
As software complexity grows, traditional static analysis tools struggle to detect vulnerabilities with both precision and context—often triggering high false positive rates and developer fatigue. This article explores how Graph Neural Networks (GNNs), when applied to source code representations like Abstract Syntax Trees (ASTs), Control Flow Graphs (CFGs), and Data Flow Graphs (DFGs), can revolutionize vulnerability detection. We break down how GNNs model code semantics more effectively than flat token sequences, and how techniques like attention mechanisms, hybrid graph construction, and feedback loops significantly reduce false positives. With insights from real-world datasets and recent research, this guide shows how to build more reliable, proactive, and interpretable vulnerability detection systems using GNNs.
This presentation explores code comprehension challenges in scientific programming based on a survey of 57 research scientists. It reveals that 57.9% of scientists have no formal training in writing readable code. Key findings highlight a "documentation paradox" where documentation is both the most common readability practice and the biggest challenge scientists face. The study identifies critical issues with naming conventions and code organization, noting that 100% of scientists agree readable code is essential for reproducible research. The research concludes with four key recommendations: expanding programming education for scientists, conducting targeted research on scientific code quality, developing specialized tools, and establishing clearer documentation guidelines for scientific software.
Presented at: The 33rd International Conference on Program Comprehension (ICPC '25)
Date of Conference: April 2025
Conference Location: Ottawa, Ontario, Canada
Preprint: https://arxiv.org/abs/2501.10037
🌍📱👉COPY LINK & PASTE ON GOOGLE http://drfiles.net/ 👈🌍
Adobe Illustrator is a powerful, professional-grade vector graphics software used for creating a wide range of designs, including logos, icons, illustrations, and more. Unlike raster graphics (like photos), which are made of pixels, vector graphics in Illustrator are defined by mathematical equations, allowing them to be scaled up or down infinitely without losing quality.
Here's a more detailed explanation:
Key Features and Capabilities:
Vector-Based Design:
Illustrator's foundation is its use of vector graphics, meaning designs are created using paths, lines, shapes, and curves defined mathematically.
Scalability:
This vector-based approach allows for designs to be resized without any loss of resolution or quality, making it suitable for various print and digital applications.
Design Creation:
Illustrator is used for a wide variety of design purposes, including:
Logos and Brand Identity: Creating logos, icons, and other brand assets.
Illustrations: Designing detailed illustrations for books, magazines, web pages, and more.
Marketing Materials: Creating posters, flyers, banners, and other marketing visuals.
Web Design: Designing web graphics, including icons, buttons, and layouts.
Text Handling:
Illustrator offers sophisticated typography tools for manipulating and designing text within your graphics.
Brushes and Effects:
It provides a range of brushes and effects for adding artistic touches and visual styles to your designs.
Integration with Other Adobe Software:
Illustrator integrates seamlessly with other Adobe Creative Cloud apps like Photoshop, InDesign, and Dreamweaver, facilitating a smooth workflow.
Why Use Illustrator?
Professional-Grade Features:
Illustrator offers a comprehensive set of tools and features for professional design work.
Versatility:
It can be used for a wide range of design tasks and applications, making it a versatile tool for designers.
Industry Standard:
Illustrator is a widely used and recognized software in the graphic design industry.
Creative Freedom:
It empowers designers to create detailed, high-quality graphics with a high degree of control and precision.
Download Wondershare Filmora Crack [2025] With Latesttahirabibi60507
Copy & Past Link 👉👉
http://drfiles.net/
Wondershare Filmora is a video editing software and app designed for both beginners and experienced users. It's known for its user-friendly interface, drag-and-drop functionality, and a wide range of tools and features for creating and editing videos. Filmora is available on Windows, macOS, iOS (iPhone/iPad), and Android platforms.
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Andre Hora
Exceptions allow developers to handle error cases expected to occur infrequently. Ideally, good test suites should test both normal and exceptional behaviors to catch more bugs and avoid regressions. While current research analyzes exceptions that propagate to tests, it does not explore other exceptions that do not reach the tests. In this paper, we provide an empirical study to explore how frequently exceptional behaviors are tested in real-world systems. We consider both exceptions that propagate to tests and the ones that do not reach the tests. For this purpose, we run an instrumented version of test suites, monitor their execution, and collect information about the exceptions raised at runtime. We analyze the test suites of 25 Python systems, covering 5,372 executed methods, 17.9M calls, and 1.4M raised exceptions. We find that 21.4% of the executed methods do raise exceptions at runtime. In methods that raise exceptions, on the median, 1 in 10 calls exercise exceptional behaviors. Close to 80% of the methods that raise exceptions do so infrequently, but about 20% raise exceptions more frequently. Finally, we provide implications for researchers and practitioners. We suggest developing novel tools to support exercising exceptional behaviors and refactoring expensive try/except blocks. We also call attention to the fact that exception-raising behaviors are not necessarily “abnormal” or rare.
4. The Ruby Language
Ruby is a dynamic programming language with a
complex but expressive grammar and
a core class library with a rich and powerful
API. Ruby draws inspiration from Lisp,
Smalltalk, and Perl, but uses a grammar that is
easy for C and Java programmers to
learn. Ruby is a pure object-oriented language,
but it is also suitable for procedural and
functional programming styles. It includes
powerful metaprogramming capabilities
and can be used to create domain-specific
languages or DSLs.
13. Package Management with gem
# gem install rails
Successfully installed activesupport-1.4.4
Successfully installed activerecord-1.15.5
Successfully installed actionpack-1.13.5
Successfully installed actionmailer-1.3.5
Successfully installed actionwebservice-1.2.5
Successfully installed rails-1.2.5
6 gems installed
Installing ri documentation for activesupport-1.4.4...
Installing ri documentation for activerecord-1.15.5...
...etc...
14. Rake
# Rake is a software task management and build automation
# tool
task :default => [:test]
task :test do
ruby "test/tc_simple_number.rb"
end
15. app/
bin/ #Files for command-line
execution
lib/
appname.rb #Classes and so on
lolcatz/
moar.rb #lolcatz::moar
Rakefile #Tasks like testing, building
Gemfile #Defines the source of the gem
README
test,spec,features/ #Whichever means of testing you go for
appname.gemspec #If it's a gem
Project Structure
17. require
Use the keyword require to import code you want to use
$ irb
>> time.now
Traceback (most recent call last):
4: from
/Users/dlresende/.rbenv/versions/2.7.1/bin/irb:23:in `<main>'
3: from
/Users/dlresende/.rbenv/versions/2.7.1/bin/irb:23:in `load'
2: from
/Users/dlresende/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gem
s/irb-1.2.3/exe/irb:11:in `<top (required)>'
1: from (irb):1
NameError (undefined local variable or method `time' for
main:Object)
Did you mean? timeout
>> require 'date'
=> true
>> Time.now
=> 2020-06-14 22:29:51.240806 +0100
18. $LOAD_PATH
require will load code that's available in $LOAD_PATH
$ irb
>> $LOAD_PATH
=> ["/usr/local/Cellar/rbenv/1.1.2/rbenv.d/exec/gem-rehash",
"/Users/dlresende/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7
.0",
"/Users/dlresende/.rbenv/versions/2.7.1/lib/ruby/site_ruby/2.7
.0/x86_64-darwin19",
"/Users/dlresende/.rbenv/versions/2.7.1/lib/ruby/site_ruby",
"/Users/dlresende/.rbenv/versions/2.7.1/lib/ruby/vendor_ruby/2
.7.0",
"/Users/dlresende/.rbenv/versions/2.7.1/lib/ruby/vendor_ruby/2
.7.0/x86_64-darwin19",
"/Users/dlresende/.rbenv/versions/2.7.1/lib/ruby/vendor_ruby",
"/Users/dlresende/.rbenv/versions/2.7.1/lib/ruby/2.7.0",
"/Users/dlresende/.rbenv/versions/2.7.1/lib/ruby/2.7.0/x86_64-
darwin19"]
19. Comments
# Comment line with #
=begin
Comment multiple lines...
…like this
Not very popular
=end
23. Combined comparison
operator (2/2)
# === (case equality)
# For class Object, effectively the same as calling ==,
# but typically overridden by descendants to provide meaningful
# semantics in case statements.
case some_object
when /a regex/
# The regex matches
when 2..4
# some_object is in the range 2..4
when lambda {|x| some_crazy_custom_predicate }
# the lambda returned true
end
24. Regexp and Range
# Regular Expressions and Ranges have a literal syntax in Ruby:
/[Rr]uby/ # Matches "Ruby" or "ruby"
/d{5}/ # Matches 5 consecutive digits
1..3 # All x where 1 <= x <= 3
1...3 # All x where 1 <= x < 3
# Regexp and Range objects define the normal == operator for
# testing equality. In addition, they also define the === operator for
# testing matching and membership.
# Ruby’s case statement (like the switch statement of C or Java)
# matches its expression against each of the possible cases using
# ===, so this operator is often called the case equality operator.
25. Bitwise operators
a = 60 # (0011 1100)
b = 13 # (0000 1101)
a & b # => 12 (0000 1100) # AND
a | b # => 60 (0011 1101) # OR
a ^ b # => 49 (0011 0001) # XOR
~a # => -61 (1100 0011) # One Complement
a << 2 # => 240 (1111 0000) # Left Shift
a >> 2 # => 15 (0000 1111) # Right Shift
26. Everything is Object
# Numeric literals are objects
3.class # => Fixnum
3.to_s # => "3"
# Arithmetic is just syntactic sugar
# for calling a method on an object
1.+(3) # => 4
10.* 5 # => 50
27. Special Values are Objects
nil # equivalent to null in other languages
true
false
nil.class # => NilClass
true.class # => TrueClass
false.class # => FalseClass
28. Logical Operators (1/2)
!true #=> false # Not
true && true #=> true # AND
true || false #=> true # OR
not true #=> false # Not
true and true #=> true # And
true or 0 #=> true # Or
# and is the same as && but with lower precedence
# they both use short-circuit evaluation (same for or)
29. Logical Operators (2/2)
# and, or operators are meant to be used as flow-control
# constructs to chain statements together until one of them
# returns true or false.
# do_something_else only called if do_something succeeds.
do_something() and do_something_else()
# log_error only called if do_something fails.
do_something() or log_error()
30. Strings
# Strings are objects
'I am a string'.class # => String
"I am a string too".class # => String
# Prefer single quoted strings to double quoted ones where
# possible
# Double quoted strings perform additional inner calculations
31. Multi-line String
$ irb
>>> puts 'This '
>>> 'is '
>>> 'a '
>>>'multi-line '
>>> 'string'
This is a multi-line string
32. String Interpolation
placeholder = 'use string interpolation'
"I can #{placeholder} when using double quoted strings"
# => "I can use string interpolation when using double quoted
strings"
34. Print to the output
# print to the output with a newline at the end
puts "I'm printing!"
# => I'm printing!
# => nil
# print to the output without a newline
print "I'm printing!"
# => I'm printing! => nil
35. Assignments (1/3)
x = 25 # => 25
x # => 25
# Note that assignment returns the value assigned
# This means you can do multiple assignment:
x = y = 10 # => 10
x # => 10
y # => 10
# By convention, use snake_case for variable names
snake_case = true
36. Assignments (2/3)
# Assignment can be combined with operators such as + and - :
x += 1 # Increment x: note Ruby does not have ++.
y -= 1 # Decrement y: no -- operator, either.
37. Assignments (3/3)
# Ruby supports parallel assignment, allowing more than one
value # and more than one variable in assignment expressions:
x, y = 1, 2 # Same as x = 1; y = 2
a, b = b, a # Swap the value of two variables
x,y,z = [1,2,3] # Array elements automatically assigned to variables
38. Symbols
# Symbols are objects.
# Symbols are immutable, reusable constants represented
# internally by an integer value.
# They're often used instead of strings to efficiently convey
# specific, meaningful values.
:pending.class # => Symbol
status = :pending
status == :pending # => true
status == 'pending' # => false
status == :approved # => false
39. Arrays (1/4)
# This is an array
array = [1, 2, 3, 4, 5] # => [1, 2, 3, 4, 5]
array.class # => Array
# Arrays can contain items of different types
[1, 'hello', false] # => [1, "hello", false]
40. Arrays (2/4)
# Arrays can be indexed…
# ...from the front
array[0] # => 1
array.first # => 1
array[12] # => nil
# ...from the end
array[-1] # => 5
array.last # => 5
# ...with a start index and length
array[2, 3] # => [3, 4, 5]
# ...or with a range
array[1..3] # => [2, 3, 4]
array[*'a'..'z'] # => ['a','b', 'c', …, 'z']
41. Arrays (3/4)
# Like arithmetic, [var] access
# is just syntactic sugar
# for calling a method [] on an object
array.[](0) # => 1
array.[] 0 # => 1
array.[] 12 # => nil
# In Ruby, parentheses are usually optional and they are
# commonly omitted, especially when the method being invoked
# takes no arguments.
42. Arrays (4/4)
# Reverse an Array
a = [1, 2, 3]
a.reverse! # => [3, 2, 1]
# Add to an array like this
array << 6 # => [1, 2, 3, 4, 5, 6]
# Or like this
array.push(6) # => [1, 2, 3, 4, 5, 6]
# Check if an item exists in the array
array.include?(1) # => true
43. Exclamation and question
marksarray = [1, 2, 3]
# The question mark is a code style convention;
# it indicates that a method returns a boolean value.
# The question mark is a valid character at the end of a method.
# These methods are called predicated methods.
array.include?(1) # => true
# In general, methods that end in ! indicate that the method will
# modify the object it's called on. Ruby calls these "dangerous
# methods" because they change state that someone else might
# have a reference to.
# These methods are called mutator methods.
array.reverse! # => [3, 2, 1]
array # => [3, 2, 1]
44. Hashes (1/2)
# Hashes are Ruby's primary dictionary with keys/value pairs.
# Hashes are denoted with curly braces:
hash = { 'color' => 'green', 'number' => 5 }
hash.keys # => ['color', 'number']
# Hashes can be quickly looked up by key:
hash['color'] # => 'green'
hash['number'] # => 5
# Asking a hash for a key that doesn't exist returns nil:
hash['nothing here'] # => nil
45. # Since Ruby 1.9, there's a special syntax when using symbols as
# keys.
# Hashes can use any object as a key, but Symbol objects are the
# most commonly used. Symbols are immutable, interned strings.
new_hash = { defcon: 3, action: true }
new_hash.keys # => [:defcon, :action]
new_hash.values # => [3, true]
# Check the existence of keys and values in hash
new_hash.key?(:defcon) # => true
new_hash.value?(3) # => true
# Tip: Both Arrays and Hashes are Enumerable
# They share a lot of useful methods such as each, map, count,
# and more
Hashes (2/2)
46. # Code blocks are chunks of code that you can associate with
# method invocations. It’s analogous to lambdas,
# anonymous functions or closures in other languages.
# We can define blocks between braces...
some_method { puts 'hello' }
# ...or between do..end
some_method do
print 'hello '
print 'world'
end
# The Ruby standard is to use braces {} for single-line blocks and
# do..end for multi-line blocks.
Blocks (1/2)
47. # The keyword yield executes the block passed to the method
def some_method
yield('hello', 'world')
end
# You can pass parameters to blocks like this:
some_method { |str1, str2| puts str1 + ' ' + str2 }
# The ability to associate a block of code with a method invocation
# is a fundamental and very powerful feature of Ruby.
Blocks (2/2)
48. # Control structures such as if that would be called
# statements in other languages are actually expressions
if true
'if'
elsif false
'else if, optional'
else
'else, optional'
end
# => "if"
Control Structures (1/7)
49. for counter in 1..5
puts "iteration #{counter}"
end
# => iteration 1
# => iteration 2
# => iteration 3
# => iteration 4
# => iteration 5
Control Structures (2/7)
50. # HOWEVER, No-one uses for loops.
# Instead you should use the "each" method and pass it a block.
# The "each" method of a range runs the block once for each
# element of the range.
# The block is passed a counter as a parameter.
# Calling the "each" method with a block looks like this:
(1..5).each { |counter| puts "iteration #{counter}" }
# => iteration 1
# => iteration 2
# => iteration 3
# => iteration 4
# => iteration 5
Control Structures (3/7)
51. # If you still need an index you can use "each_with_index"
# and define an index variable
array.each_with_index do |element, index|
puts "#{element} is number #{index} in the array"
end
Control Structures (4/7)
52. counter = 1
while counter <= 5 do
puts "iteration #{counter}"
counter += 1
end
# => iteration 1
# => iteration 2
# => iteration 3
# => iteration 4
# => iteration 5
# although the language does support while loops, it is more
# common to perform loops with iterator methods:
3.times { print "Ruby! " } # Prints "Ruby! Ruby! Ruby! "
Control Structures (5/7)
53. letter = 'B'
case letter
when 'A'
puts 'a'
when 'B'
puts 'b'
when 'C'
puts 'c'
else
puts 'none of the above'
end
#=> "b"
Control Structures (6/7)
54. # cases can also use ranges
grade = 82
case grade
when 90..100
puts 'Hooray!'
when 80...90
puts 'OK job'
else
puts 'You failed!'
end
#=> "OK job"
Control Structures (7/7)
55. begin
# code here that might raise an exception
raise NoMemoryError, 'You ran out of memory.'
rescue NoMemoryError => exception_variable
puts 'NoMemoryError was raised', exception_variable
rescue RuntimeError => other_exception_variable
puts 'RuntimeError was raised now'
else
puts 'This runs if no exceptions were thrown at all'
ensure
puts 'This code always runs no matter what'
end
Exception handling
56. # Methods (and all blocks) implicitly return the value of the last
# statement
def sum(x, y)
x + y
end
# Parentheses are optional where the result is unambiguous
# Method arguments are separated by a comma
sum 3, 4 #=> 7
sum sum(3, 4), 5 #=> 12
Methods (1/10)
58. # Define another name for the same method.
# It is common for methods to have multiple names in Ruby
alias size length # size is now a synonym for length
Methods (3/10)
59. # All methods have an implicit, optional block parameter
# that can be invoked with the yield keyword
def surround
print '{'
yield
print '}'
end
surround { print 'hello'}
# => {hello}
Methods (4/10)
60. # You can pass a block to a function
# "&" marks a reference to a passed block
def guests(&block)
block.call 'some_argument'
end
guests { |input| print input}
#=> some_argument
Methods (5/10)
61. # If you pass a list of arguments, it will be converted to an array
# That's what splat operator ("*") is for
def list(*array)
array.each { |elem| print elem }
end
list(1, 2, 3)
#=> 123
Methods (6/10)
62. # If a method returns an array, you can use destructuring
# assignment
def foods
['pancake', 'sandwich', 'quesadilla']
end
breakfast, lunch, dinner = foods
breakfast #=> 'pancake'
dinner #=> 'quesadilla'
lunch #=> 'sandwich'
Methods (7/10)
63. def global_quare(x)
x*x
end
# When a method is defined outside of a class or a module, it is
effectively a global function rather than a method to be invoked
on an object. (Technically, however, a method like this becomes a
private method of the Object class.)
# In Ruby there are 3 types of methods:
- public: anyone can access
- protected: can only be called by instances of a class (or
subclasses)
- private: can only be called by instances of the class
Methods (8/10)
64. # Methods can also be defined on individual objects by prefixing
# the name of the method with the object on which it is defined.
# Methods like these are known as singleton methods, and they
# are how Ruby defines class methods:
def Math.square(x)
x*x
end
# Define a class method of the Math module
# The Math module is part of the core Ruby library, and this code
adds a new method to it. This is a key feature of Ruby—classes
and modules are “open” and can be modified and extended at
runtime.
Methods (9/10)
65. # Methods that end with an equals sign = are special because
# Ruby allows them to be invoked using assignment syntax.
# If an object o has a method named x= , then the following two
# lines of code do the very same thing:
o.x=(1) # Normal method invocation syntax
o.x = 1 # Method invocation through assignment
Methods (10/10)
66. # A class is a collection of related methods that operate on the state of an object
class Human
# A class variable (or attributes) is shared by all instances of this class.
@@species = 'H. sapiens'
def initialize(name, age = 0) # Basic initializer, gets called on Human.new
# Assign the argument to the "name" instance variable for the instance
@name = name
# If no age given, we will fall back to the default in the arguments list.
@age = age
end
def name=(name) # Basic setter method
@name = name
end
def name # Basic getter method
@name
end
end
Classes (1/5)
67. class Human
@@species = 'H. sapiens'
# A class method uses self to distinguish from instance methods.
# It can only be called on the class, not an instance.
# self is actually the class name.
# In Ruby docs class methods are represented with a ".": Human.say
def self.say(msg)
puts msg
end
# Also use self when calling writer methods: self.species=
# ...so that Ruby knows we're calling the method, not the variable
# Instance method
# In Ruby docs instance methods are represented with a "#": Human#species
def species
@@species
end
end
Classes (2/5)
68. # Instantiate a class
diego = Human.new('Diego Lemos')
# Calling methods
diego.species #=> "H. sapiens"
diego.name #=> "Diego Lemos"
diego.name = 'Diego LEMOS' #=> "Diego LEMOS"
diego.name #=> "Diego LEMOS"
# Calling the class method
Human.say('hello') #=> "hello"
Classes (3/5)
69. class Person
# Getter/setter methods can also be created individually like this:
attr_reader :name # will create the conventional method name
attr_writer :name # will create the conventional method name=
end
person = Person.new
person.name = 'Diego'
person.name # => "Diego"
Classes (4/5)
70. class Person
# Even this can get repetitive.
# When you want both reader and writer just use accessor!
attr_accessor :name
end
person = Person.new
person.name = 'Diego'
person.name # => "Diego"
Classes (5/5)
71. # Variables that start with $ have global scope
$var = 'global variable'
defined? $var #=> "global-variable"
# Variables that start with @ have instance scope
@var = 'instance variable'
defined? @var #=> "instance-variable"
# Variables that start with @@ have class scope
@@var = 'class var'
defined? @@var #=> "class variable"
# Variables that start with a capital letter are constants
Var = 'constant'
defined? Var #=> "constant"
Variables’ scope
72. class Human
# Class variable is shared among the class and all of its descendants
@@foo = 0
def self.foo
@@foo
end
def self.foo=(value)
@@foo = value
end
end
class Worker < Human
end
Human.foo #=> 0
Worker.foo #=> 0
Human.foo = 2 #=> 2
Worker.foo #=> 2
Derived classes (1/2)
73. class Human
# Class instance variable is not shared by the class's descendants
@bar = 0
def self.bar
@bar
end
def self.bar=(value)
@bar = value
end
end
class Doctor < Human
end
Human.bar # => 0
Doctor.bar # => nil
Derived classes (2/2)
74. module ModuleExample
def foo
'foo'
end
class MyClass; end # Module becomes a namespace: ModuleExample::MyClass.new
end
# Including modules binds their methods to the class instances
class Person
include ModuleExample
end
Person.foo # => NoMethodError: undefined method `foo' for Person:Class
Person.new.foo # => 'foo'
# Extending modules binds their methods to the class itself
class Book
extend ModuleExample
end
Book.foo # => 'foo'
Book.new.foo # => NoMethodError: undefined method `foo' << Modules cannot be
instantiated
Modules
76. # Ruby provides a framework in its standard library for setting up,
# organizing, and running tests called Test::Unit.
require_relative "../lib/simple_number"
require "test/unit"
class TestSimpleNumber < Test::Unit::TestCase
def test_simple
assert_equal(4, SimpleNumber.new(2).add(2) )
assert_equal(6, SimpleNumber.new(2).multiply(3) )
end
end
Test::Unit