The document is an exam paper for a 3 hour, 100 mark software engineering exam. It contains 6 main questions testing knowledge across various areas of software engineering. Question 1 has 7 short questions worth 20 marks total, questions 2-4 have 4 short questions each worth 16 marks total, questions 5-6 have longer multi-part questions worth 16 marks each. The questions cover topics such as software engineering principles, data modeling, testing objectives, project scheduling, process frameworks, modeling techniques, quality strategies and more.
Stacks are data structures that follow the last-in, first-out (LIFO) principle. Elements are inserted and removed from the top of the stack. Common operations include push, which adds an element to the top, and pop, which removes the top element. Stacks have applications in expression evaluation, recursion, and parsing. They can be implemented using arrays or linked lists.
This document summarizes a presentation about using the GraphQL query language with Elixir and Absinthe. It introduces GraphQL and discusses its benefits over REST, including strong typing, fetching exact data requirements, and introspection capabilities. Resolvers and the DataLoader library are presented as ways to efficiently fetch data in GraphQL. The document recommends additional reading materials on GraphQL schema design, mutations, and real-world implementations.
The document discusses storage area networks (SANs) and fiber channel technology. It provides background on SANs and how they function as a separate high-speed network connecting storage resources like RAID systems directly to servers. It then covers SAN topologies using fiber channel, including point-to-point, arbitrated loop, and fabric switch configurations. Finally, it discusses planning, managing and the management perspective of SANs in the data center.
The document discusses Android development and UI design. It introduces some common widgets in Android like TextView, buttons, and different layouts like linear, relative and table layouts. It also discusses activities, services, intents and the Android component and manifest files.
This document provides an agenda for hardening Windows 2003 web servers. It covers various topics including physical security, OS installation, account policies, local policies, services configuration, user accounts, IP policies, permissions, hardening IIS, and additional hardening techniques. The goal is to create a secure environment and maintain security by configuring the OS, services, user accounts, permissions and IIS according to security best practices.
The document outlines various security concepts including attacks, services, mechanisms, and methods of defense for network security. It discusses security attacks like interruption, interception, modification, and fabrication. It also covers security services like confidentiality, authentication, integrity, non-repudiation, and availability. Finally, it mentions methods of defense such as encryption, software and hardware controls, policies, and physical controls.
Presentation about nice functional programming things you can do with python. and some simple techniques you can use to do a good and functional design
Sorayya Khan's novel "City of Spies" tells the story of 11-year-old Aliya Shah, who is struggling with her identity between her Pakistani father and Dutch mother in 1970s Pakistan. As political unrest grows under General Zia's regime, Aliya observes the arrests of Zulfiqar Ali Bhutto and the impact on those close to her like her servant's son Hanif. When anti-American protests erupt, Aliya's American friend Lizzy and her family are forced to leave the country. The novel explores Aliya's coming-of-age and search for identity amid the country's turmoil during this volatile period in Pakistan's history.
ICCV2009: MAP Inference in Discrete Models: Part 5zukun
The course program document outlines the schedule for a one-day tutorial on comparison of optimization methods. The schedule includes sessions on discrete models in computer vision, message passing algorithms, quadratic pseudo-boolean optimization, transformation and move-making methods, and recent advances such as dual decomposition and higher-order models. All materials from the tutorial will be made available online after the conference at the listed URL.
This document defines storage area networks (SANs) and discusses their architecture, technologies, management, security and benefits. A SAN consists of storage devices connected via a dedicated network that allows servers to access storage independently. Fibre Channel is the most widely used technology but iSCSI and FCIP allow block storage over IP networks. Effective SAN management requires coordination across storage, network and system levels. Security measures like authentication, authorization and encryption help protect data in this shared storage environment.
This lecture will cover sets and set operations from the textbook "Discrete Mathematics & Its Applications" by Kenneth H. Rosen. The topics to be discussed are sets and set operations, with the lecture focusing on defining what sets are and exploring operations that can be performed on sets such as unions, intersections, and complements. Multiple examples of sets and set operations will be examined in detail during the lecture.
Core collectors are a type of spy that uses street smarts, cultural knowledge, language skills, and subject matter expertise to gather information. In the United States, the Central Intelligence Agency employs spies, called clandestine service agents, to work for the CIA's National Clandestine Service. Clandestine service agents earn between $52,976 to $81,204 per year, similar to the average income of $68,820 for detectives and crime investigators.
This document discusses various topics related to criminal justice programs and profiling of serial killers. It includes outlines on profiling serial killers and the SARA problem solving model. It also covers classical, biological, social and psychological theories of crime. Various criminal justice organizations and conferences are mentioned. Case studies related to Ted Bundy are discussed in the context of criminal justice programs and profiling.
Internet servers hosting online applications need to be scalable to handle large numbers of simultaneous users. There are three main techniques for load balancing across replicated servers: DNS rotation, cooperative offloading using TCP handoff, and load balancing routers. DNS rotation requires few changes but has rigid policies while cooperative offloading and load balancing routers can be more adaptive but require changes to servers, clients, or routers.
World War 2 involved extensive spying and intelligence gathering efforts. The US established the Coordinator of Information in 1941 to collect and analyze national security data, but the FBI was reluctant to share information. After the Pearl Harbor attacks, it was clear that intelligence coordination needed improvement. The Office of Strategic Services was formed in 1942 to conduct clandestine operations like training foreign troops and sending operatives behind enemy lines. Notable OSS agent Moe Berg was a Major League Baseball player who used his language skills and undercover abilities on missions in Yugoslavia, Norway, and Italy. The military also had their own intelligence operations such as code breaking and interrogating prisoners of war. After the war, the OSS was dissolved and re
The document discusses trends in various industries and demographic groups. It provides statistics on year-over-year growth and key demographics for several companies including Abbott Laboratories, Pacific Life, CVS Caremark, and trends for age groups ranging from 13-70 years old. Unknown terms are used that make the overall meaning difficult to discern from the document.
The document provides an overview of an introductory lecture for an Industrial Information Systems course, outlining the topics to be covered which include database design, architecture design methods, and web application implementation; it also provides the course schedule, textbook information, communication methods, grading policy, and advice for student success.
The double lives of spies in the civil war power pointAlyssa Fabia
Rose O'Neal Greenhow and Elizabeth Van Lew both spied for opposing sides during the American Civil War while living in the enemy capital. Rose spied for the Confederacy in Washington D.C., passing messages through her spy ring. She was eventually caught and imprisoned. Elizabeth Van Lew spied for the Union from Richmond, using her home to hide escaping Union soldiers and pass them messages and supplies despite the danger. Both women lived double lives and took great risks to aid their respective causes during the war.
This book provides style and usage guidelines for programmers using Fortran. It is intended for anyone using Fortran, from beginners to experts. The book describes best practices for formatting, naming conventions, documentation, programming principles, input/output handling, and other aspects of the Fortran language. It focuses primarily on Fortran 2003 but also describes features of Fortran 90/95 and 2008.
Given what a beautiful and mature functional programming language R is, there is a surprising, though understandable, lack of visibility of functional programming techniques in R. This is a talk given to the Mumbai R meetup group in October/November, 2014, meant to introduce the audience to Functional Programming in R.
XML Publisher is a reporting platform for Oracle Fusion Applications that allows business users to create reports without technical assistance. It uses XML data sources, templates, and an engine to generate reports. The process involves creating an application engine to supply sample data and schemas, developing an RTF template, defining the data source and report in PeopleSoft, updating the application engine for full data, and running it to output reports. Advanced features include bursting, content libraries, and translations. While it provides a flexible single toolset, some XML/XSL knowledge is needed for complex reports and Excel output is basic.
Windows Server 2008 is a powerful web application and services platform that provides improved manageability, lower infrastructure costs, and powerful hosting of applications and services. New features include increased scalability, a server core installation option, support for additional web technologies like PHP, and enhanced media delivery options. Administration is simplified through tools like the unified Server Manager and powerful new APIs for automation.
The document discusses relations and their application to databases in the relational data model. It defines binary and n-ary relations, and explains how databases can be represented as n-ary relations with records as n-tuples consisting of fields. Primary keys are introduced as fields that uniquely identify each record. Common relational operations like projection and join are explained, with examples provided to illustrate how they transform relations.
Factories, mocks and spies: a tester's little helperstxels
This document provides an overview of various tools that can help when writing tests, including factories, spies, and mocks. It discusses how each tool can be used to help with different parts of testing like test setup (preparation phase), checking internal behavior, and simulating dependencies. Factory Boy is presented as a tool for generating complex test data structures simply. KGB is shown as a spying library for checking method calls. Mocks from the mock library are demonstrated for simulating object behavior. Hamcrest matchers are described as reusable conditions for assertions. Custom matchers can also be written with matchmaker to dry up assertions.
C++ stl design overview talk at C++ users meetup Ho Chi Minh City. May 2016. Includes an overview of iterators, data structures and algorithms and how they are meant to be used together.
Introduction to C++
Difference between C and C++
Evolution of C++
Procedure Oriented Programming vs Object OrientedProgramming
Key concepts of Object-Oriented Programming
Advantages and Disadvantages of OOP
Presentation about nice functional programming things you can do with python. and some simple techniques you can use to do a good and functional design
Sorayya Khan's novel "City of Spies" tells the story of 11-year-old Aliya Shah, who is struggling with her identity between her Pakistani father and Dutch mother in 1970s Pakistan. As political unrest grows under General Zia's regime, Aliya observes the arrests of Zulfiqar Ali Bhutto and the impact on those close to her like her servant's son Hanif. When anti-American protests erupt, Aliya's American friend Lizzy and her family are forced to leave the country. The novel explores Aliya's coming-of-age and search for identity amid the country's turmoil during this volatile period in Pakistan's history.
ICCV2009: MAP Inference in Discrete Models: Part 5zukun
The course program document outlines the schedule for a one-day tutorial on comparison of optimization methods. The schedule includes sessions on discrete models in computer vision, message passing algorithms, quadratic pseudo-boolean optimization, transformation and move-making methods, and recent advances such as dual decomposition and higher-order models. All materials from the tutorial will be made available online after the conference at the listed URL.
This document defines storage area networks (SANs) and discusses their architecture, technologies, management, security and benefits. A SAN consists of storage devices connected via a dedicated network that allows servers to access storage independently. Fibre Channel is the most widely used technology but iSCSI and FCIP allow block storage over IP networks. Effective SAN management requires coordination across storage, network and system levels. Security measures like authentication, authorization and encryption help protect data in this shared storage environment.
This lecture will cover sets and set operations from the textbook "Discrete Mathematics & Its Applications" by Kenneth H. Rosen. The topics to be discussed are sets and set operations, with the lecture focusing on defining what sets are and exploring operations that can be performed on sets such as unions, intersections, and complements. Multiple examples of sets and set operations will be examined in detail during the lecture.
Core collectors are a type of spy that uses street smarts, cultural knowledge, language skills, and subject matter expertise to gather information. In the United States, the Central Intelligence Agency employs spies, called clandestine service agents, to work for the CIA's National Clandestine Service. Clandestine service agents earn between $52,976 to $81,204 per year, similar to the average income of $68,820 for detectives and crime investigators.
This document discusses various topics related to criminal justice programs and profiling of serial killers. It includes outlines on profiling serial killers and the SARA problem solving model. It also covers classical, biological, social and psychological theories of crime. Various criminal justice organizations and conferences are mentioned. Case studies related to Ted Bundy are discussed in the context of criminal justice programs and profiling.
Internet servers hosting online applications need to be scalable to handle large numbers of simultaneous users. There are three main techniques for load balancing across replicated servers: DNS rotation, cooperative offloading using TCP handoff, and load balancing routers. DNS rotation requires few changes but has rigid policies while cooperative offloading and load balancing routers can be more adaptive but require changes to servers, clients, or routers.
World War 2 involved extensive spying and intelligence gathering efforts. The US established the Coordinator of Information in 1941 to collect and analyze national security data, but the FBI was reluctant to share information. After the Pearl Harbor attacks, it was clear that intelligence coordination needed improvement. The Office of Strategic Services was formed in 1942 to conduct clandestine operations like training foreign troops and sending operatives behind enemy lines. Notable OSS agent Moe Berg was a Major League Baseball player who used his language skills and undercover abilities on missions in Yugoslavia, Norway, and Italy. The military also had their own intelligence operations such as code breaking and interrogating prisoners of war. After the war, the OSS was dissolved and re
The document discusses trends in various industries and demographic groups. It provides statistics on year-over-year growth and key demographics for several companies including Abbott Laboratories, Pacific Life, CVS Caremark, and trends for age groups ranging from 13-70 years old. Unknown terms are used that make the overall meaning difficult to discern from the document.
The document provides an overview of an introductory lecture for an Industrial Information Systems course, outlining the topics to be covered which include database design, architecture design methods, and web application implementation; it also provides the course schedule, textbook information, communication methods, grading policy, and advice for student success.
The double lives of spies in the civil war power pointAlyssa Fabia
Rose O'Neal Greenhow and Elizabeth Van Lew both spied for opposing sides during the American Civil War while living in the enemy capital. Rose spied for the Confederacy in Washington D.C., passing messages through her spy ring. She was eventually caught and imprisoned. Elizabeth Van Lew spied for the Union from Richmond, using her home to hide escaping Union soldiers and pass them messages and supplies despite the danger. Both women lived double lives and took great risks to aid their respective causes during the war.
This book provides style and usage guidelines for programmers using Fortran. It is intended for anyone using Fortran, from beginners to experts. The book describes best practices for formatting, naming conventions, documentation, programming principles, input/output handling, and other aspects of the Fortran language. It focuses primarily on Fortran 2003 but also describes features of Fortran 90/95 and 2008.
Given what a beautiful and mature functional programming language R is, there is a surprising, though understandable, lack of visibility of functional programming techniques in R. This is a talk given to the Mumbai R meetup group in October/November, 2014, meant to introduce the audience to Functional Programming in R.
XML Publisher is a reporting platform for Oracle Fusion Applications that allows business users to create reports without technical assistance. It uses XML data sources, templates, and an engine to generate reports. The process involves creating an application engine to supply sample data and schemas, developing an RTF template, defining the data source and report in PeopleSoft, updating the application engine for full data, and running it to output reports. Advanced features include bursting, content libraries, and translations. While it provides a flexible single toolset, some XML/XSL knowledge is needed for complex reports and Excel output is basic.
Windows Server 2008 is a powerful web application and services platform that provides improved manageability, lower infrastructure costs, and powerful hosting of applications and services. New features include increased scalability, a server core installation option, support for additional web technologies like PHP, and enhanced media delivery options. Administration is simplified through tools like the unified Server Manager and powerful new APIs for automation.
The document discusses relations and their application to databases in the relational data model. It defines binary and n-ary relations, and explains how databases can be represented as n-ary relations with records as n-tuples consisting of fields. Primary keys are introduced as fields that uniquely identify each record. Common relational operations like projection and join are explained, with examples provided to illustrate how they transform relations.
Factories, mocks and spies: a tester's little helperstxels
This document provides an overview of various tools that can help when writing tests, including factories, spies, and mocks. It discusses how each tool can be used to help with different parts of testing like test setup (preparation phase), checking internal behavior, and simulating dependencies. Factory Boy is presented as a tool for generating complex test data structures simply. KGB is shown as a spying library for checking method calls. Mocks from the mock library are demonstrated for simulating object behavior. Hamcrest matchers are described as reusable conditions for assertions. Custom matchers can also be written with matchmaker to dry up assertions.
C++ stl design overview talk at C++ users meetup Ho Chi Minh City. May 2016. Includes an overview of iterators, data structures and algorithms and how they are meant to be used together.
Introduction to C++
Difference between C and C++
Evolution of C++
Procedure Oriented Programming vs Object OrientedProgramming
Key concepts of Object-Oriented Programming
Advantages and Disadvantages of OOP
Taming the Legacy Beast: Turning wild old code into a sleak new thoroughbread.Chris Laning
Got a legacy application? Trying to turn into a modern one? This presentation, given by Chris Laning, takes you through a methodical process that helps you attack that seemingly insurmountable task and tame it like a pro! The presentation is ColdFusion focused, but many of the methods employed could be used by programmers in other languages. This presentation was given at NCDevCon on September 13, 2014 in Raleigh, NC.
Chris is a Senior WebDeveloper and has been doing web development since 1996.
Aspect Oriented Programming (AOP) is the name given to a set of techniques that let specify seperatly various concerns (aspects). This lead usually to the separation of technical concerns (aspects) from business software logic. This technique is based on aspect and relationship among them description and a weaving operation that inject in the code (source or binary) elements described in the aspect.
In this presentation, after a brief introduction and prospects of AOP, we will introduce you a specific implementation with PHP.
This presentation was made in Agile and Automation Conclave 2018 in Bangalore by Ganesh from CodeOps.
"Most developers are aware about design patterns. The difficulty is not in understanding them but in getting an intuitive understanding of when and how to apply them. In this session, we'll go through a case study of how a compiler codebase may implement different design patterns. Links to related code in Java and C# will be provided. (Note: No prior exposure to compilers needed for attending this session.)"
The document discusses object-oriented programming and C++. It begins with an introduction to OOP compared to procedural programming. Key concepts of OOP like classes, objects, inheritance and polymorphism are explained. The document then discusses C++ programming, including the structure of C++ programs, basic input/output functions, data types in C++, variables and constants. Pointers in C++ and how computer memory works with pointers are also summarized.
Building search and discovery services for Schibsted (LSRS '17)Sandra Garcia
Presentation given at the Large Scale Recommender Systems workshop (LSRS) in Recsys 2017.
This presentation describes the search and discovery products we are working on in Schibsted for the domains of news and marketplaces as well as the challenges within each of these domains. It also covers how we bring these services into production including the system architecture and deployment process.
The document discusses some of the promises and perils of mining software repositories like Git and GitHub for research purposes. It notes that while these sources contain rich data on software development, there are also challenges to consider. For example, decentralized version control systems like Git allow private collaboration that may be missed. And most GitHub projects are personal and inactive, while it is also used for storage and hosting. The document recommends researchers approach these data sources carefully and provides lessons on how to properly analyze and interpret the data from repositories like Git and GitHub.
Not Your Fathers C - C Application Development In 2016maiktoepfer
- The document discusses different approaches for copying strings in C, including strcpy, strncpy, strlcpy, and strcpy_s.
- strcpy can cause buffer overflows if the destination is too small, while strncpy does not guarantee a properly terminated string.
- strlcpy aims to prevent overflows and ensure valid strings, but may truncate and requires external libraries.
- strcpy_s from C11 solves the problems of previous functions and is part of the standard, but support is limited.
PracticalExperiences Migrating Unified Modeling Language Models to IBM® Rati...Einar Karlsen
The presentation presents some experiences migrating UML models to Rational Software Architect. It covers the topics: Motivations and Mechanisms, Migration Process
Migration from Rational Rose and Rational XDE to RSA,
Migration from 3rd Party UML Tools, Basic Rules and Conclusions.
This short text will get you up to speed in no time on creating visualizations using R's ggplot2 package. It was developed as part of a training to those who had no prior experience in R and had limited knowledge on general programming concepts. It's a must have initial guide for those exploring the field of Data Science
1. Reproducible research is the ability to reproduce an experiment or study by independently reproducing the entire process and obtaining the same results. This is a core principle of the scientific method.
2. Using R and RStudio aids reproducibility by encouraging researchers to structure projects systematically, automate analyses with code rather than manual steps, and connect analyses and results to written reports through tools like R Markdown.
3. Version control systems like git allow researchers to track changes, revert to previous versions of documents and code, and facilitate collaboration through online repositories like GitHub.
This document discusses best practices for deploying analytic models from development environments into operational systems. It describes how modeling environments often use different languages than deployment environments, requiring significant effort to move models. The document outlines the life cycle of analytic models, from exploratory data analysis to model deployment and monitoring. It also discusses standards like PMML and PFA that can be used to export models between different applications and analytic engines that integrate models into operational workflows.
The document discusses advanced machine learning workflows that can be implemented using WhizzML, an automated machine learning programming language. It provides examples of implementing best-first feature selection, stacked generalization, and gradient boosting algorithms as workflows composed of machine learning operations. The document outlines how algorithms like these that are composed of iterative modeling, prediction, and evaluation steps can be automated and scaled using the composable primitives and backend infrastructure of WhizzML. It highlights how non-trivial model selection, automation of tasks, and advanced algorithms are possible with WhizzML workflows.
- Alan Kay coined the term "object-oriented programming" in 1972 in a paper where the word "class" only appeared once. Classes came into Smalltalk around 1976 from Simula 67.
- trygve was conceived to address the largest gaps between current OOP and the original vision of OOP through the use of DCI. Research shows that programmers using trygve's DCI approach perform better than those using a traditional OO approach.
- Contextual roles allow objects to dynamically take on different meanings based on the context they are used in, enabling contextualized polymorphism.
RESTful Machine Learning with Flask and TensorFlow Serving - Carlo MazzaferroPyData
Those of us who use TensorFlow often focus on building the model that's most predictive, not the one that's most deployable. So how to put that hard work to work? In this talk, we'll walk through a strategy for taking your machine learning models from Jupyter Notebook into production and beyond.
GenAI-powered assistants compared in a real case - 2025-03-18Alessandra Bilardi
AWS User Group Venezia #7
How to choose GenAI-powered assistants.
https://www.meetup.com/aws-user-group-venezia/events/305666720/
Join Ajay Sarpal and Miray Vu to learn about key Marketo Engage enhancements. Discover improved in-app Salesforce CRM connector statistics for easy monitoring of sync health and throughput. Explore new Salesforce CRM Synch Dashboards providing up-to-date insights into weekly activity usage, thresholds, and limits with drill-down capabilities. Learn about proactive notifications for both Salesforce CRM sync and product usage overages. Get an update on improved Salesforce CRM synch scale and reliability coming in Q2 2025.
Key Takeaways:
Improved Salesforce CRM User Experience: Learn how self-service visibility enhances satisfaction.
Utilize Salesforce CRM Synch Dashboards: Explore real-time weekly activity data.
Monitor Performance Against Limits: See threshold limits for each product level.
Get Usage Over-Limit Alerts: Receive notifications for exceeding thresholds.
Learn About Improved Salesforce CRM Scale: Understand upcoming cloud-based incremental sync.
Explaining GitHub Actions Failures with Large Language Models Challenges, In...ssuserb14185
GitHub Actions (GA) has become the de facto tool that developers use to automate software workflows, seamlessly building, testing, and deploying code. Yet when GA fails, it disrupts development, causing delays and driving up costs. Diagnosing failures becomes especially challenging because error logs are often long, complex and unstructured. Given these difficulties, this study explores the potential of large language models (LLMs) to generate correct, clear, concise, and actionable contextual descriptions (or summaries) for GA failures, focusing on developers’ perceptions of their feasibility and usefulness. Our results show that over 80% of developers rated LLM explanations positively in terms of correctness for simpler/small logs. Overall, our findings suggest that LLMs can feasibly assist developers in understanding common GA errors, thus, potentially reducing manual analysis. However, we also found that improved reasoning abilities are needed to support more complex CI/CD scenarios. For instance, less experienced developers tend to be more positive on the described context, while seasoned developers prefer concise summaries. Overall, our work offers key insights for researchers enhancing LLM reasoning, particularly in adapting explanations to user expertise.
https://arxiv.org/abs/2501.16495
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...Egor Kaleynik
This case study explores how we partnered with a mid-sized U.S. healthcare SaaS provider to help them scale from a successful pilot phase to supporting over 10,000 users—while meeting strict HIPAA compliance requirements.
Faced with slow, manual testing cycles, frequent regression bugs, and looming audit risks, their growth was at risk. Their existing QA processes couldn’t keep up with the complexity of real-time biometric data handling, and earlier automation attempts had failed due to unreliable tools and fragmented workflows.
We stepped in to deliver a full QA and DevOps transformation. Our team replaced their fragile legacy tests with Testim’s self-healing automation, integrated Postman and OWASP ZAP into Jenkins pipelines for continuous API and security validation, and leveraged AWS Device Farm for real-device, region-specific compliance testing. Custom deployment scripts gave them control over rollouts without relying on heavy CI/CD infrastructure.
The result? Test cycle times were reduced from 3 days to just 8 hours, regression bugs dropped by 40%, and they passed their first HIPAA audit without issue—unlocking faster contract signings and enabling them to expand confidently. More than just a technical upgrade, this project embedded compliance into every phase of development, proving that SaaS providers in regulated industries can scale fast and stay secure.
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.
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.
How can one start with crypto wallet development.pptxlaravinson24
This presentation is a beginner-friendly guide to developing a crypto wallet from scratch. It covers essential concepts such as wallet types, blockchain integration, key management, and security best practices. Ideal for developers and tech enthusiasts looking to enter the world of Web3 and decentralized finance.
Interactive Odoo Dashboard for various business needs can provide users with dynamic, visually appealing dashboards tailored to their specific requirements. such a module that could support multiple dashboards for different aspects of a business
✅Visit And Buy Now : https://bit.ly/3VojWza
✅This Interactive Odoo dashboard module allow user to create their own odoo interactive dashboards for various purpose.
App download now :
Odoo 18 : https://bit.ly/3VojWza
Odoo 17 : https://bit.ly/4h9Z47G
Odoo 16 : https://bit.ly/3FJTEA4
Odoo 15 : https://bit.ly/3W7tsEB
Odoo 14 : https://bit.ly/3BqZDHg
Odoo 13 : https://bit.ly/3uNMF2t
Try Our website appointment booking odoo app : https://bit.ly/3SvNvgU
👉Want a Demo ?📧 [email protected]
➡️Contact us for Odoo ERP Set up : 091066 49361
👉Explore more apps: https://bit.ly/3oFIOCF
👉Want to know more : 🌐 https://www.axistechnolabs.com/
#odoo #odoo18 #odoo17 #odoo16 #odoo15 #odooapps #dashboards #dashboardsoftware #odooerp #odooimplementation #odoodashboardapp #bestodoodashboard #dashboardapp #odoodashboard #dashboardmodule #interactivedashboard #bestdashboard #dashboard #odootag #odooservices #odoonewfeatures #newappfeatures #odoodashboardapp #dynamicdashboard #odooapp #odooappstore #TopOdooApps #odooapp #odooexperience #odoodevelopment #businessdashboard #allinonedashboard #odooproducts
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfTechSoup
In this webinar we will dive into the essentials of generative AI, address key AI concerns, and demonstrate how nonprofits can benefit from using Microsoft’s AI assistant, Copilot, to achieve their goals.
This event series to help nonprofits obtain Copilot skills is made possible by generous support from Microsoft.
What You’ll Learn in Part 2:
Explore real-world nonprofit use cases and success stories.
Participate in live demonstrations and a hands-on activity to see how you can use Microsoft 365 Copilot in your own work!
FL Studio Producer Edition Crack 2025 Full Versiontahirabibi60507
Copy & Past Link 👉👉
http://drfiles.net/
FL Studio is a Digital Audio Workstation (DAW) software used for music production. It's developed by the Belgian company Image-Line. FL Studio allows users to create and edit music using a graphical user interface with a pattern-based music sequencer.
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
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.
Get & Download Wondershare Filmora Crack Latest [2025]saniaaftab72555
Copy & Past Link 👉👉
https://dr-up-community.info/
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.
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.
Adobe Lightroom Classic Crack FREE Latest link 2025kashifyounis067
Ad
Functional style programming
1. Functional-style programming
HCMC C++ users meetup
Germán Diago Gómez
April 24th, 2016
Germán Diago Gómez Functional-style programming April 24th, 2016 1 / 31
2. Overview Introduction
Goals of this talk
Introduce some functional-style patterns in C++.
Germán Diago Gómez Functional-style programming April 24th, 2016 2 / 31
3. Overview Introduction
Goals of this talk
Introduce some functional-style patterns in C++.
Show some examples combined with the STL.
Germán Diago Gómez Functional-style programming April 24th, 2016 2 / 31
4. Overview Introduction
Goals of this talk
Introduce some functional-style patterns in C++.
Show some examples combined with the STL.
Present some more advanced examples of its use at the end.
Germán Diago Gómez Functional-style programming April 24th, 2016 2 / 31
5. Overview Introduction
Non-goals
Not a pure-functional Haskell-style programming talk.
Germán Diago Gómez Functional-style programming April 24th, 2016 3 / 31
7. Functional programming Overview
Main traits
Use of immutable data.
Use of pure functions.
Germán Diago Gómez Functional-style programming April 24th, 2016 4 / 31
8. Functional programming Overview
Main traits
Use of immutable data.
Use of pure functions.
Use of lazy evaluation.
Germán Diago Gómez Functional-style programming April 24th, 2016 4 / 31
9. Functional programming Overview
Main traits
Use of immutable data.
Use of pure functions.
Use of lazy evaluation.
Heavy use of recursivity.
Germán Diago Gómez Functional-style programming April 24th, 2016 4 / 31
10. Functional programming Overview
Main traits
Use of immutable data.
Use of pure functions.
Use of lazy evaluation.
Heavy use of recursivity.
Functions as data. They can be parameters to other functions.
Germán Diago Gómez Functional-style programming April 24th, 2016 4 / 31
11. Functional programming Overview
Main traits
Use of immutable data.
Use of pure functions.
Use of lazy evaluation.
Heavy use of recursivity.
Functions as data. They can be parameters to other functions.
Functions can also be returned.
Germán Diago Gómez Functional-style programming April 24th, 2016 4 / 31
12. Functional programming Overview
Main traits
Use of immutable data.
Use of pure functions.
Use of lazy evaluation.
Heavy use of recursivity.
Functions as data. They can be parameters to other functions.
Functions can also be returned.
Composability.
Germán Diago Gómez Functional-style programming April 24th, 2016 4 / 31
13. Functional programming Overview
Three important functional algorithms
map → std::transform in STL.
Germán Diago Gómez Functional-style programming April 24th, 2016 5 / 31
14. Functional programming Overview
Three important functional algorithms
map → std::transform in STL.
filter → std::remove_if in STL.
Germán Diago Gómez Functional-style programming April 24th, 2016 5 / 31
15. Functional programming Overview
Three important functional algorithms
map → std::transform in STL.
filter → std::remove_if in STL.
reduce → std::accumulate in STL.
Germán Diago Gómez Functional-style programming April 24th, 2016 5 / 31
16. Functional programming Overview
Three important functional algorithms
map → std::transform in STL.
filter → std::remove_if in STL.
reduce → std::accumulate in STL.
They are the base of many powerful patterns and algorithms.
Germán Diago Gómez Functional-style programming April 24th, 2016 5 / 31
17. Functional programming Overview
Why functional programming
Multithreaded code becomes much easier to deal with (no locks needed).
Germán Diago Gómez Functional-style programming April 24th, 2016 6 / 31
18. Functional programming Overview
Why functional programming
Multithreaded code becomes much easier to deal with (no locks needed).
Code much easier to parallelize automatically.
Germán Diago Gómez Functional-style programming April 24th, 2016 6 / 31
19. Functional programming Overview
Why functional programming
Multithreaded code becomes much easier to deal with (no locks needed).
Code much easier to parallelize automatically.
Higher-order functions enable algorithms customization.
Germán Diago Gómez Functional-style programming April 24th, 2016 6 / 31
20. Functional programming Overview
Why functional programming
Multithreaded code becomes much easier to deal with (no locks needed).
Code much easier to parallelize automatically.
Higher-order functions enable algorithms customization.
Without rewriting algorithms for special cases.
Germán Diago Gómez Functional-style programming April 24th, 2016 6 / 31
21. Functional programming Overview
Why functional programming
Multithreaded code becomes much easier to deal with (no locks needed).
Code much easier to parallelize automatically.
Higher-order functions enable algorithms customization.
Without rewriting algorithms for special cases.
Higher order functions enable other useful patterns.
Germán Diago Gómez Functional-style programming April 24th, 2016 6 / 31
22. Functional programming Overview
Why functional programming
Multithreaded code becomes much easier to deal with (no locks needed).
Code much easier to parallelize automatically.
Higher-order functions enable algorithms customization.
Without rewriting algorithms for special cases.
Higher order functions enable other useful patterns.
Pure functions: can be memoized.
Germán Diago Gómez Functional-style programming April 24th, 2016 6 / 31
23. C++ functional style Overview
Main traits
Use of function objects.
Germán Diago Gómez Functional-style programming April 24th, 2016 7 / 31
24. C++ functional style Overview
Main traits
Use of function objects.
Use of lambdas.
Germán Diago Gómez Functional-style programming April 24th, 2016 7 / 31
25. C++ functional style Overview
Main traits
Use of function objects.
Use of lambdas.
Creating callables that return other callables.
Germán Diago Gómez Functional-style programming April 24th, 2016 7 / 31
26. C++ functional style Overview
Main traits
Use of function objects.
Use of lambdas.
Creating callables that return other callables.
Pass function objects/lambdas as parameters, usually to STL algorithms.
Germán Diago Gómez Functional-style programming April 24th, 2016 7 / 31
27. C++ functional style Function objects
What is a function object?
A struct or class.
Germán Diago Gómez Functional-style programming April 24th, 2016 8 / 31
28. C++ functional style Function objects
What is a function object?
A struct or class.
Implements the call operator operator().
Germán Diago Gómez Functional-style programming April 24th, 2016 8 / 31
29. C++ functional style Function objects
What is a function object?
A struct or class.
Implements the call operator operator().
Objects whose class/struct implements operator() can be called the same
way as functions are called.
Germán Diago Gómez Functional-style programming April 24th, 2016 8 / 31
30. C++ functional style Function objects
Why function objects are important
The STL makes heavy use of them.
Germán Diago Gómez Functional-style programming April 24th, 2016 9 / 31
31. C++ functional style Function objects
Why function objects are important
The STL makes heavy use of them.
Can carry state, unlike classic C style functions.
Germán Diago Gómez Functional-style programming April 24th, 2016 9 / 31
32. C++ functional style Function objects
Why function objects are important
The STL makes heavy use of them.
Can carry state, unlike classic C style functions.
Efficient: Easier to inline than function pointers and pointers to members.
Germán Diago Gómez Functional-style programming April 24th, 2016 9 / 31
33. C++ functional style Function objects
Why function objects are important
The STL makes heavy use of them.
Can carry state, unlike classic C style functions.
Efficient: Easier to inline than function pointers and pointers to members.
Better code generation.
Germán Diago Gómez Functional-style programming April 24th, 2016 9 / 31
34. C++ functional style Function objects
Why function objects are important
The STL makes heavy use of them.
Can carry state, unlike classic C style functions.
Efficient: Easier to inline than function pointers and pointers to members.
Better code generation.
If you understand function objects you understand lambdas.
Germán Diago Gómez Functional-style programming April 24th, 2016 9 / 31
35. C++ functional style Function objects
Predicates
A predicate is a callable that returns true or false given some input parameter(s).
Germán Diago Gómez Functional-style programming April 24th, 2016 10 / 31
36. C++ functional style Function objects
Example (Unary predicate function object)
struct is_negative {
bool operator()(int n) const {
return n < 0;
}
};
std::cout << is_negative{}(-5);
Germán Diago Gómez Functional-style programming April 24th, 2016 11 / 31
37. C++ functional style Function objects
Example (Unary predicate function object)
struct is_negative {
bool operator()(int n) const {
return n < 0;
}
};
std::cout << is_negative{}(-5);
Output
1
Germán Diago Gómez Functional-style programming April 24th, 2016 11 / 31
38. C++ functional style Function objects
Example (Binary predicate function object)
struct food {
std::string food_name;
double average_user_score;
};
struct more_delicious {
bool operator()(food const & f1, food const & f2) const {
return f1.average_user_score > f2.average_user_score;
}
};
food const pho{"pho", 8.1}, com_tam{"com tam", 7.6};
std::cout << "Pho more declicious? -> "
<< more_delicious{}(pho, com_tam);
Germán Diago Gómez Functional-style programming April 24th, 2016 12 / 31
39. C++ functional style Function objects
Example (Binary predicate function object)
struct food {
std::string food_name;
double average_user_score;
};
struct more_delicious {
bool operator()(food const & f1, food const & f2) const {
return f1.average_user_score > f2.average_user_score;
}
};
food const pho{"pho", 8.1}, com_tam{"com tam", 7.6};
std::cout << "Pho more declicious? -> "
<< more_delicious{}(pho, com_tam);
Output
Pho more declicious? -> 1
Germán Diago Gómez Functional-style programming April 24th, 2016 12 / 31
40. C++ functional style Function objects
Other function objects
Ternary predicates could also exist.
Germán Diago Gómez Functional-style programming April 24th, 2016 13 / 31
41. C++ functional style Function objects
Other function objects
Ternary predicates could also exist.
The STL only uses unary and binary.
Germán Diago Gómez Functional-style programming April 24th, 2016 13 / 31
42. C++ functional style Function objects
Other function objects
Ternary predicates could also exist.
The STL only uses unary and binary.
Not all function objects are necessarily predicates.
Germán Diago Gómez Functional-style programming April 24th, 2016 13 / 31
43. C++ functional style Function objects
Other function objects
Ternary predicates could also exist.
The STL only uses unary and binary.
Not all function objects are necessarily predicates.
Although in the STL predicates are very common in algorithms.
Germán Diago Gómez Functional-style programming April 24th, 2016 13 / 31
44. C++ functional style Function objects
(Live demo)
Germán Diago Gómez Functional-style programming April 24th, 2016 14 / 31
45. C++ functional style Function objects
Problems with function objects
Verbose: must create a class always.
Germán Diago Gómez Functional-style programming April 24th, 2016 15 / 31
46. C++ functional style Function objects
Problems with function objects
Verbose: must create a class always.
Usually used once and thrown away.
Germán Diago Gómez Functional-style programming April 24th, 2016 15 / 31
47. C++ functional style Function objects
Problems with function objects
Verbose: must create a class always.
Usually used once and thrown away.
Write a class for one use only?
Germán Diago Gómez Functional-style programming April 24th, 2016 15 / 31
48. C++ functional style Function objects
Alternatives to handcrafted fuction objects
Use predefined function objects. STL: std::less, std::multiplies and
many others. Insufficient.
Germán Diago Gómez Functional-style programming April 24th, 2016 16 / 31
49. C++ functional style Function objects
Alternatives to handcrafted fuction objects
Use predefined function objects. STL: std::less, std::multiplies and
many others. Insufficient.
Compose objects via std::bind. Composing with std::bind is
complicated, less efficient than lambdas and potentially surprising. Avoid.
Germán Diago Gómez Functional-style programming April 24th, 2016 16 / 31
50. C++ functional style Function objects
Alternatives to handcrafted fuction objects
Use predefined function objects. STL: std::less, std::multiplies and
many others. Insufficient.
Compose objects via std::bind. Composing with std::bind is
complicated, less efficient than lambdas and potentially surprising. Avoid.
Make use of lambda functions.
Germán Diago Gómez Functional-style programming April 24th, 2016 16 / 31
51. C++ functional style Function objects
Alternatives to handcrafted fuction objects
Use predefined function objects. STL: std::less, std::multiplies and
many others. Insufficient.
Compose objects via std::bind. Composing with std::bind is
complicated, less efficient than lambdas and potentially surprising. Avoid.
Make use of lambda functions.
We will focus on lambda functions.
Germán Diago Gómez Functional-style programming April 24th, 2016 16 / 31
52. Lambda functions Overview
Lambda functions
Lambda functions are syntactic sugar for function objects.
Germán Diago Gómez Functional-style programming April 24th, 2016 17 / 31
53. Lambda functions Overview
Lambda functions
Lambda functions are syntactic sugar for function objects.
They are equally efficient.
Germán Diago Gómez Functional-style programming April 24th, 2016 17 / 31
54. Lambda functions Overview
Lambda functions
Lambda functions are syntactic sugar for function objects.
They are equally efficient.
Not verbose.
Germán Diago Gómez Functional-style programming April 24th, 2016 17 / 31
55. Lambda functions Overview
Lambda functions
Lambda functions are syntactic sugar for function objects.
They are equally efficient.
Not verbose.
Two kinds in C++
Germán Diago Gómez Functional-style programming April 24th, 2016 17 / 31
56. Lambda functions Overview
Lambda functions
Lambda functions are syntactic sugar for function objects.
They are equally efficient.
Not verbose.
Two kinds in C++
Monomorphic lambdas: non-templated operator().
Germán Diago Gómez Functional-style programming April 24th, 2016 17 / 31
57. Lambda functions Overview
Lambda functions
Lambda functions are syntactic sugar for function objects.
They are equally efficient.
Not verbose.
Two kinds in C++
Monomorphic lambdas: non-templated operator().
Polymorphic lambdas: templated operator().
Germán Diago Gómez Functional-style programming April 24th, 2016 17 / 31
58. Lambda functions Overview
Anatomy of a lambda function
[capture-list-opt](params) mutable-opt noexcept-opt ->
ret_type { body }.
Germán Diago Gómez Functional-style programming April 24th, 2016 18 / 31
59. Lambda functions Overview
Anatomy of a lambda function
[capture-list-opt](params) mutable-opt noexcept-opt ->
ret_type { body }.
The [] is called the lambda introducer.
Germán Diago Gómez Functional-style programming April 24th, 2016 18 / 31
60. Lambda functions Overview
Anatomy of a lambda function
[capture-list-opt](params) mutable-opt noexcept-opt ->
ret_type { body }.
The [] is called the lambda introducer.
The capture list is optional.
Germán Diago Gómez Functional-style programming April 24th, 2016 18 / 31
61. Lambda functions Overview
Anatomy of a lambda function
[capture-list-opt](params) mutable-opt noexcept-opt ->
ret_type { body }.
The [] is called the lambda introducer.
The capture list is optional.
The ret_type is also optional, otherwise it is deduced from the body.
Germán Diago Gómez Functional-style programming April 24th, 2016 18 / 31
62. Lambda functions Overview
Anatomy of a lambda function
[capture-list-opt](params) mutable-opt noexcept-opt ->
ret_type { body }.
The [] is called the lambda introducer.
The capture list is optional.
The ret_type is also optional, otherwise it is deduced from the body.
Lambdas generate by default lambda_class::operator() const.
Germán Diago Gómez Functional-style programming April 24th, 2016 18 / 31
63. Lambda functions Overview
Given the following code. . .
std::vector<int> data = {1, 3, 5, 2, 1, 28};
int threshold = 20;
std::partition(std::begin(data), std::end(data), 0,
[threshold](int a)
{ return a < threshold; });
Every lambda function generates a different compiler struct type.
Germán Diago Gómez Functional-style programming April 24th, 2016 19 / 31
64. Lambda functions Overview
. . . the compiler generates something like this
struct __anon_object {
__anon_object(int _threshold) : //capture variables
threshold(_threshold) {}
decltype(auto) operator(int a, int b) const {
return a < threshold; }
int const threshold; //captured by value
};
std::vector<int> data = {1, 3, 5, 2, 1, 28};
int threshold = 20;
std::partition(std::begin(data), std::end(data), 0,
__anon_object{threshold});
Every lambda generated is unique even if they contain the same code,
captures, etc.
Germán Diago Gómez Functional-style programming April 24th, 2016 20 / 31
66. Lambda functions Example
Lambdas are very powerful
Can capture the environment (stateful).
Germán Diago Gómez Functional-style programming April 24th, 2016 22 / 31
67. Lambda functions Example
Lambdas are very powerful
Can capture the environment (stateful).
They are not verbose as function objects.
Germán Diago Gómez Functional-style programming April 24th, 2016 22 / 31
68. Lambda functions Example
Lambdas are very powerful
Can capture the environment (stateful).
They are not verbose as function objects.
Lambdas can save a lot of code but still keep it efficient.
Germán Diago Gómez Functional-style programming April 24th, 2016 22 / 31
69. Examples Partial function application
Problem: partial function application
We have a function that renders some text into a target screen with a given size
and orientation.
void render_text(Screen & target, int font_size,
int pos_x, int pos_y,
Orientation text_orientation,
std::string const & text);
We want to call this function all the time with the same parameters to render
different text, but it becomes very tedious: many parameters must be passed.
Germán Diago Gómez Functional-style programming April 24th, 2016 23 / 31
70. Examples Partial function application
Solution
Screen screen; //Non-copyable
auto render_at_top_left = [=, &screen](std::string const & text) {
return render_text(screen,
80,
k_left_side_screen,
k_top_screen,
Orientation::Horizontal,
text);
};
render_at_top_left("Hello, world!");
Germán Diago Gómez Functional-style programming April 24th, 2016 24 / 31
71. Examples Measure function wrapper
Problem: timing functions
We want to measure the time it takes to run a function or piece of code and some
functions from some APIs.
We do not have access to the source code of the functions we want to
measure.
Germán Diago Gómez Functional-style programming April 24th, 2016 25 / 31
72. Examples Measure function wrapper
using namespace std;
template <class Func>
auto timed_func(Func && f) {
return [f = forward<Func>(f)](auto &&... args) {
auto init_time = sc::high_resolution_clock::now();
f(forward<decltype(args)>(args)...);
auto total_exe_time = sc::high_resolution_clock::now()
- init_time;
return sc::duration_cast<sc::milliseconds>
(total_exe_time).count();
};
}
int main() {
vector<int> vec; vec.reserve(2’000’000);
int num = 0;
while (cin >> num) vec.push_back(num);
auto timed_sort = timed_func([&vec]() { sort(begin(vec),
end(vec)); });
Germán Diago Gómez Functional-style programming April 24th, 2016 25 / 31
73. Examples Map and reduce with STL
cout << "Sorting 2,000,000 numbers took "
<< timed_sort() << " milliseconds.n";
}
Germán Diago Gómez Functional-style programming April 24th, 2016 26 / 31
74. Examples Map and reduce with STL
Problem: map/reduce data.
Calculate the average of the squares of some series of data
Germán Diago Gómez Functional-style programming April 24th, 2016 26 / 31
75. Examples Map and reduce with STL
Solution
using namespace std;
vector<int> vec(20);
iota(begin(vec), end(vec), 1);
vector <int> res(20);
transform(std::begin(vec), end(vec), std::begin(res),
[](int val) { return val * val; });
auto total = accumulate(begin(res), end(res), 0,
[](int acc, int val) { return val + acc; });
std::cout << total << ’n’;
Germán Diago Gómez Functional-style programming April 24th, 2016 27 / 31
76. Heterogeneus function objects Holding arbitrary callables
Holding any callable
Lambdas and function objects have their own concrete type.
Germán Diago Gómez Functional-style programming April 24th, 2016 28 / 31
77. Heterogeneus function objects Holding arbitrary callables
Holding any callable
Lambdas and function objects have their own concrete type.
No common class even if can be invoked with same parameters.
Germán Diago Gómez Functional-style programming April 24th, 2016 28 / 31
78. Heterogeneus function objects Holding arbitrary callables
Holding any callable
Lambdas and function objects have their own concrete type.
No common class even if can be invoked with same parameters.
This is good because it enables inlining easily. . .
Germán Diago Gómez Functional-style programming April 24th, 2016 28 / 31
79. Heterogeneus function objects Holding arbitrary callables
Holding any callable
Lambdas and function objects have their own concrete type.
No common class even if can be invoked with same parameters.
This is good because it enables inlining easily. . .
. . . but bad because you cannot store collections of callables or do indirect
calls to them.
Germán Diago Gómez Functional-style programming April 24th, 2016 28 / 31
80. Heterogeneus function objects Holding arbitrary callables
Holding any callable
Lambdas and function objects have their own concrete type.
No common class even if can be invoked with same parameters.
This is good because it enables inlining easily. . .
. . . but bad because you cannot store collections of callables or do indirect
calls to them.
C++ has function objects, lambdas, pointers to members, function
pointers. . .
Germán Diago Gómez Functional-style programming April 24th, 2016 28 / 31
81. Heterogeneus function objects Holding arbitrary callables
Holding any callable
Lambdas and function objects have their own concrete type.
No common class even if can be invoked with same parameters.
This is good because it enables inlining easily. . .
. . . but bad because you cannot store collections of callables or do indirect
calls to them.
C++ has function objects, lambdas, pointers to members, function
pointers. . .
With different call syntaxes.
Germán Diago Gómez Functional-style programming April 24th, 2016 28 / 31
82. Heterogeneus function objects Holding arbitrary callables
Holding any callable
Lambdas and function objects have their own concrete type.
No common class even if can be invoked with same parameters.
This is good because it enables inlining easily. . .
. . . but bad because you cannot store collections of callables or do indirect
calls to them.
C++ has function objects, lambdas, pointers to members, function
pointers. . .
With different call syntaxes.
How can we store arbitrary callables in containers?
Germán Diago Gómez Functional-style programming April 24th, 2016 28 / 31
83. Heterogeneus function objects Holding arbitrary callables
std::function<FuncSignature>
std::function can store arbitrary callables.
Germán Diago Gómez Functional-style programming April 24th, 2016 29 / 31
84. Heterogeneus function objects Holding arbitrary callables
std::function<FuncSignature>
std::function can store arbitrary callables.
the callables that can store depend on the signature given in its template
parameter.
Germán Diago Gómez Functional-style programming April 24th, 2016 29 / 31
85. Heterogeneus function objects Holding arbitrary callables
std::function<FuncSignature>
std::function can store arbitrary callables.
the callables that can store depend on the signature given in its template
parameter.
can capture anything callable: functions, member functions, function objects,
lambdas. . .
Germán Diago Gómez Functional-style programming April 24th, 2016 29 / 31
86. Heterogeneus function objects Holding arbitrary callables
std::function use cases
Use when you do not know what you will store until run-time.
Germán Diago Gómez Functional-style programming April 24th, 2016 30 / 31
87. Heterogeneus function objects Holding arbitrary callables
std::function use cases
Use when you do not know what you will store until run-time.
Use to store callables in containers. Command pattern is implemented by
std::function directly.
Germán Diago Gómez Functional-style programming April 24th, 2016 30 / 31
88. Heterogeneus function objects Holding arbitrary callables
std::function use cases
Use when you do not know what you will store until run-time.
Use to store callables in containers. Command pattern is implemented by
std::function directly.
Prefer auto to std::function when possible for your variables, though.
More efficient.
Germán Diago Gómez Functional-style programming April 24th, 2016 30 / 31
89. The end
struct Calculator {
int current_result = 5;
int add_with_context(int a, int b) {
return a + b + current_result;
}
};
int add(int a, int b) { return a + b; }
int main() {
std::function<int (int, int)> bin_op;
bin_op = add; //Store plain function
std::cout << bin_op(3, 5) << std::endl;
Calculator c;
bin_op = std::multiplies<int>{}; //Store function object
std::cout << bin_op(3, 5) << std::endl;
//Call member function capturing calculator object:
bin_op = [&c](int a, int b) { return c.add_with_context(a, b); };
std::cout << bin_op(3, 5) << std::endl;
}
Germán Diago Gómez Functional-style programming April 24th, 2016 31 / 31