Modules are wrappers around Ruby code that cannot be instantiated. They are used to bundle logically related objects together and provide namespaces to avoid naming conflicts. Modules can also be used as mixins by including them in classes to add additional functionality. The document provides examples of using modules as namespaces and mixins, and discusses how to load, require, and include modules from separate files. It also covers how the Enumerable and Comparable modules can be included to add common iteration and comparison methods to classes.
METHODS DESCRIPTION
copy() They copy() method returns a shallow copy of the dictionary.
clear() The clear() method removes all items from the dictionary.
pop() Removes and returns an element from a dictionary having the given key.
popitem() Removes the arbitrary key-value pair from the dictionary and returns it as tuple.
get() It is a conventional method to access a value for a key.
dictionary_name.values() returns a list of all the values available in a given dictionary.
str() Produces a printable string representation of a dictionary.
update() Adds dictionary dict2’s key-values pairs to dict
setdefault() Set dict[key]=default if key is not already in dict
keys() Returns list of dictionary dict’s keys
items() Returns a list of dict’s (key, value) tuple pairs
has_key() Returns true if key in dictionary dict, false otherwise
fromkeys() Create a new dictionary with keys from seq and values set to value.
type() Returns the type of the passed variable.
cmp() Compares elements of both dict.
This is one of my old slide. I took an one day class in BRAC University in 2007 on taking input in Java programming language. This tutorial is for begginer studemts.
Java Collections | Collections Framework in Java | Java Tutorial For Beginner...Edureka!
**** Java Certification Training: https://www.edureka.co/java-j2ee-soa-training ****
This Edureka tutorial on “Java Collections” will talk about the complete hierarchy of Collections Frameworks in Java. It will walk you through the various fundamentals of collections like Lists, Queue, Sets, Interfaces etc. Through this tutorial you will learn the following topics:
Java Collection Framework
Collection Framework Hierarchy
Interfaces
List
Queue
Set
Check out our Java Tutorial blog series: https://goo.gl/osrGrS
Check out our complete Youtube playlist here: https://goo.gl/gMFLx3
METHODS DESCRIPTION
copy() They copy() method returns a shallow copy of the dictionary.
clear() The clear() method removes all items from the dictionary.
pop() Removes and returns an element from a dictionary having the given key.
popitem() Removes the arbitrary key-value pair from the dictionary and returns it as tuple.
get() It is a conventional method to access a value for a key.
dictionary_name.values() returns a list of all the values available in a given dictionary.
str() Produces a printable string representation of a dictionary.
update() Adds dictionary dict2’s key-values pairs to dict
setdefault() Set dict[key]=default if key is not already in dict
keys() Returns list of dictionary dict’s keys
items() Returns a list of dict’s (key, value) tuple pairs
has_key() Returns true if key in dictionary dict, false otherwise
fromkeys() Create a new dictionary with keys from seq and values set to value.
type() Returns the type of the passed variable.
cmp() Compares elements of both dict.
This is one of my old slide. I took an one day class in BRAC University in 2007 on taking input in Java programming language. This tutorial is for begginer studemts.
Java Collections | Collections Framework in Java | Java Tutorial For Beginner...Edureka!
**** Java Certification Training: https://www.edureka.co/java-j2ee-soa-training ****
This Edureka tutorial on “Java Collections” will talk about the complete hierarchy of Collections Frameworks in Java. It will walk you through the various fundamentals of collections like Lists, Queue, Sets, Interfaces etc. Through this tutorial you will learn the following topics:
Java Collection Framework
Collection Framework Hierarchy
Interfaces
List
Queue
Set
Check out our Java Tutorial blog series: https://goo.gl/osrGrS
Check out our complete Youtube playlist here: https://goo.gl/gMFLx3
Python too supports file handling and allows users to handle files i.e., to read and write files, along with many other file handling options, to operate on files. The concept of file handling has stretched over various other languages, but the implementation is either complicated or lengthy, but alike other concepts of Python, this concept here is also easy and short. Python treats file differently as text or binary and this is important. Each line of code includes a sequence of characters and they form text file. Each line of a file is terminated with a special character, called the EOL or End of Line characters like comma {,} or newline character. It ends the current line and tells the interpreter a new one has begun. Let’s start with Reading and Writing files.
These questions will be a bit advanced level 2sadhana312471
These questions will be a bit advanced(Intermediate) in terms of Python interview.
This is the continuity of Nail the Python Interview Questions.
The fields that these questions will help you in are:
• Python Developer
• Data Analyst
• Research Analyst
• Data Scientist
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
In the rapidly evolving landscape of technologies, XML continues to play a vital role in structuring, storing, and transporting data across diverse systems. The recent advancements in artificial intelligence (AI) present new methodologies for enhancing XML development workflows, introducing efficiency, automation, and intelligent capabilities. This presentation will outline the scope and perspective of utilizing AI in XML development. The potential benefits and the possible pitfalls will be highlighted, providing a balanced view of the subject.
We will explore the capabilities of AI in understanding XML markup languages and autonomously creating structured XML content. Additionally, we will examine the capacity of AI to enrich plain text with appropriate XML markup. Practical examples and methodological guidelines will be provided to elucidate how AI can be effectively prompted to interpret and generate accurate XML markup.
Further emphasis will be placed on the role of AI in developing XSLT, or schemas such as XSD and Schematron. We will address the techniques and strategies adopted to create prompts for generating code, explaining code, or refactoring the code, and the results achieved.
The discussion will extend to how AI can be used to transform XML content. In particular, the focus will be on the use of AI XPath extension functions in XSLT, Schematron, Schematron Quick Fixes, or for XML content refactoring.
The presentation aims to deliver a comprehensive overview of AI usage in XML development, providing attendees with the necessary knowledge to make informed decisions. Whether you’re at the early stages of adopting AI or considering integrating it in advanced XML development, this presentation will cover all levels of expertise.
By highlighting the potential advantages and challenges of integrating AI with XML development tools and languages, the presentation seeks to inspire thoughtful conversation around the future of XML development. We’ll not only delve into the technical aspects of AI-powered XML development but also discuss practical implications and possible future directions.
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!SOFTTECHHUB
As the digital landscape continually evolves, operating systems play a critical role in shaping user experiences and productivity. The launch of Nitrux Linux 3.5.0 marks a significant milestone, offering a robust alternative to traditional systems such as Windows 11. This article delves into the essence of Nitrux Linux 3.5.0, exploring its unique features, advantages, and how it stands as a compelling choice for both casual users and tech enthusiasts.
Dr. Sean Tan, Head of Data Science, Changi Airport Group
Discover how Changi Airport Group (CAG) leverages graph technologies and generative AI to revolutionize their search capabilities. This session delves into the unique search needs of CAG’s diverse passengers and customers, showcasing how graph data structures enhance the accuracy and relevance of AI-generated search results, mitigating the risk of “hallucinations” and improving the overall customer journey.
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Threats to mobile devices are more prevalent and increasing in scope and complexity. Users of mobile devices desire to take full advantage of the features
available on those devices, but many of the features provide convenience and capability but sacrifice security. This best practices guide outlines steps the users can take to better protect personal devices and information.
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIVladimir Iglovikov, Ph.D.
Presented by Vladimir Iglovikov:
- https://www.linkedin.com/in/iglovikov/
- https://x.com/viglovikov
- https://www.instagram.com/ternaus/
This presentation delves into the journey of Albumentations.ai, a highly successful open-source library for data augmentation.
Created out of a necessity for superior performance in Kaggle competitions, Albumentations has grown to become a widely used tool among data scientists and machine learning practitioners.
This case study covers various aspects, including:
People: The contributors and community that have supported Albumentations.
Metrics: The success indicators such as downloads, daily active users, GitHub stars, and financial contributions.
Challenges: The hurdles in monetizing open-source projects and measuring user engagement.
Development Practices: Best practices for creating, maintaining, and scaling open-source libraries, including code hygiene, CI/CD, and fast iteration.
Community Building: Strategies for making adoption easy, iterating quickly, and fostering a vibrant, engaged community.
Marketing: Both online and offline marketing tactics, focusing on real, impactful interactions and collaborations.
Mental Health: Maintaining balance and not feeling pressured by user demands.
Key insights include the importance of automation, making the adoption process seamless, and leveraging offline interactions for marketing. The presentation also emphasizes the need for continuous small improvements and building a friendly, inclusive community that contributes to the project's growth.
Vladimir Iglovikov brings his extensive experience as a Kaggle Grandmaster, ex-Staff ML Engineer at Lyft, sharing valuable lessons and practical advice for anyone looking to enhance the adoption of their open-source projects.
Explore more about Albumentations and join the community at:
GitHub: https://github.com/albumentations-team/albumentations
Website: https://albumentations.ai/
LinkedIn: https://www.linkedin.com/company/100504475
Twitter: https://x.com/albumentations
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
UiPath Test Automation using UiPath Test Suite series, part 5DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 5. In this session, we will cover CI/CD with devops.
Topics covered:
CI/CD with in UiPath
End-to-end overview of CI/CD pipeline with Azure devops
Speaker:
Lyndsey Byblow, Test Suite Sales Engineer @ UiPath, Inc.
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...SOFTTECHHUB
The choice of an operating system plays a pivotal role in shaping our computing experience. For decades, Microsoft's Windows has dominated the market, offering a familiar and widely adopted platform for personal and professional use. However, as technological advancements continue to push the boundaries of innovation, alternative operating systems have emerged, challenging the status quo and offering users a fresh perspective on computing.
One such alternative that has garnered significant attention and acclaim is Nitrux Linux 3.5.0, a sleek, powerful, and user-friendly Linux distribution that promises to redefine the way we interact with our devices. With its focus on performance, security, and customization, Nitrux Linux presents a compelling case for those seeking to break free from the constraints of proprietary software and embrace the freedom and flexibility of open-source computing.
2. Module
Module are wrapper around the ruby code.
Module cannot be instantiated.
Module are used in conjunction with the
classes.
3. Modules: namespaces
bundle logically related object together.
identifies a set of names when objects having different
origins but the same names are mixed together.
-so that there is no ambiguity.
5. Namespace can:
Keep class name distinct from another ruby class.
Ensure classes used in open source won't conflict.
6. Module:Mix-ins
Ruby doesn't let us have multiple inheritance.
For additional functionality-
place into a module and mixed it in to any class that needs
it.
Powerful way to keep the code organize.
12. Modules are usually kept in separate file.
Need to have a way to load modules into ruby.
13. include:
use module as maxin.
has nothing to do with loading the files
load:
load the file everytime we call. hence return true on every call
use when you want to refresh the code and one to call the second time.
disadvantage
Once ruby sees the file, there is no reason to call it again.
The code in load execute every time we call it .
require:
Keep track of the fact that is included.
only include if it has not been loaded before.
load source file only once.
15. Modules:Enumerable as Mixin
provides a number of methods for objects which are
iterable collection of other objects, like arrays, ranges or
hashes.
ex: sort, reject, detect, select, collect, inject
They may have slightly different behaviour in each one but are the same functionality.
must provide method each,-yields every member of the
collection one-by-one.
each-takes the block of code and iterates all the object of
the collection, passing it to the given block.
19. compare the objects- if they are equal, less or greater than other, and to sort
the collection of such objects.
The class must define the <=> (Spaceship) operator, which compares the
receiver against another object,
Ruby built-in object, like Fixnum or String, use this mixin to provide comparing
operator.
returns -1 if the left object is greater than the right one, 0 when they are equal
and 1 in case the right is greater then the left
20. Example
class Server
attr_reader :name, :no_processors, :memory_gb # we must provide readers to
this attributes
include Comparable # because we are comparing the other
Server with self
def initialize(name, no_processors, memory_gb)
@name = name
@no_processors = no_processors
@memory_gb = memory_gb
end
# def inspect
# "/Server: #{@name}: #{@no_processors} procs, #{@memory_gb} GiB mem/"
# end
def <=>(other)
if self.no_processors == other.no_processors # if there is the
same number of procs
self.memory_gb <=> other.memory_gb #
comparing memory
else
self.no_processors <=> other.no_processors # otherwise
comparing the number of processors
end
endend
21. Class work
Class Assignment : Write a class Animal with attributes name and
scientific_name. Write a class Human with attributes first_name, last_name and
scientific_name. Write a mixin called Name which has a method
complete_name. Include this mixin in both Animal and Human class.
The method should return “name(scientific_name)” for animals e.g. Frog(Rana
Tigrina). For Human it should return “first_name last_name(scientific name)”
e.g. John Doe(Homo Sapiens)
23. Input/Output basic
Input: -> into a ruby program.
Basic ruby inputs
gets
Output:-> from that program.
Basic ruby outputs
puts
print
24. Introduction
File represents digital information that exists on durable storage.
In Ruby File<IO
File is just a type of input and output.
Read from the file-> input
Write to the file->output
25. Writing(output) to files
file= File.new(‘test.txt’, ‘w’)
‘W’: Write-only, truncates existing file
to zero length or creates a new file for writing
file.puts “abcd”
file.close
OR
file.prints “efgh” or
file.writes “ijkl”- returns number of character that it wrote.
file << “mnop”
26. Reading(Input) from files
file= File.new(‘test.txt’, ‘r’)
"r" Read-only, starts at beginning of file (default mode)
file.gets
=> "uvwx"
Note: puts vs gets
file.gets -> get next line.
file.read(4): takes in how many character to read
file.close.
27. Opening files
We open an existing file using
File.open(“test.txt”, ‘r’).
We will pass the file name and a second
argument which will decide how the file will be
opened.
Open File For Reading
Reading file contents is easy in Ruby. Here are two options:
File.read("file_name") - Spits out entire contents of the file.
File.readlines("file_name") - Reads the entire file based on
individual lines and returns those lines in an array.
28. "r" Read-only, starts at beginning of file
(default mode).
"r+" Read-write, starts at beginning of file.
"w" Write-only, truncates existing file
to zero length or creates a new file
for writing.
"w+" Read-write, truncates existing file to zero
length
or creates a new file for reading and
writing.
"a" Write-only, starts at end of file if file exists,
otherwise creates a new file for
writing.
"a+" Read-write, starts at end of file if file exists,
otherwise creates a new file for
reading and
writing.
29. Open File For Writing
We can use write or puts to write files.
Difference
puts- adds a line break to the end of strings
write- does not.
File.open("simple_file.txt", "w") { |file|
file.write("adding first line of text") }
Note: the file closes at the end of the block.
30. Other examples:
2.1.1 :017 > File.read('simple_file1.txt')
=> "adding first line of text"
2.1.1 :018 > File.open('simple_file1.txt','a+') do |file|
2.1.1 :019 > file.write('writing to the file1')
2.1.1 :020?> end
=> 20
2.1.1 :021 > File.read('simple_file1.txt')
=> "adding first line of textwriting to the file1"
2.1.1 :022 > File.open('simple_file1.txt','w+') do |file|
2.1.1 :023 > file.write('where m i ')
2.1.1 :024?> end
=> 10
2.1.1 :025 > File.read('simple_file1.txt')
=> "where m i "
32. Assignments
Day 4
Class Assignment 1: Write a module named MyFileModule. It should following methods:
a. create_file(path)
b. edit_file(path,content)
c. delete_file(path)
Necessary exception handling should be done.
Class Assignment 2: Write a class Animal with attributes name and scientific_name. Write a class Human with attributes
first_name, last_name and scientific_name. Write a mixin called Name which has a method complete_name. Include this mixin in
both Animal and Human class.
The method should return “name(scientific_name)” for animals e.g. Frog(Rana Tigrina). For Human it should return “first_name
last_name(scientific name)” e.g. John Doe(Homo Sapiens)
1. Write a program to adjust time in a movie subtitle. The input to the program should be path to the subtitle file and adjust time in
seconds (positive value to increase and negative value to decrease time). The program then creates a new subtitle file with
adjusted time without changing.