This document provides an overview of C# language features including creating and using objects, exceptions handling, strings, generics, collections, and attributes. It discusses classes and objects, namespaces, value and reference types, properties, methods, constructors, and structures. It also covers exception handling principles, the System.Exception class and exception hierarchy. Finally, it discusses strings and text processing in C#, the System.String class, and string manipulation methods.
import in python is similar to #include header_file in C/C++. Python modules can get access to code from another module by importing the file/function using import. The import statement is the most common way of invoking the import machinery, but it is not the only way. import module_name .When the import is used, it searches for the module initially in the local scope by calling __import__() function. The value returned by the function is then reflected in the output of the initial code.
import in python is similar to #include header_file in C/C++. Python modules can get access to code from another module by importing the file/function using import. The import statement is the most common way of invoking the import machinery, but it is not the only way. import module_name .When the import is used, it searches for the module initially in the local scope by calling __import__() function. The value returned by the function is then reflected in the output of the initial code.
Slides to understand and present Advanced .net topics with c# language. Topics like delegates, Indexer, Reflection API, Attributes, Collections in c#, File and I/O manipulation etc. are described with examples too.
Class object method constructors in javaRaja Sekhar
Presented By :
N.V.Raja Sekhar Reddy
www.technolamp.co.in
www.programming9.com
Want more interesting...
Watch and Like us @ https://www.facebook.com/Technolamp.co.in
subscribe videos @ http://www.youtube.com/user/nvrajasekhar
Slides to understand and present Advanced .net topics with c# language. Topics like delegates, Indexer, Reflection API, Attributes, Collections in c#, File and I/O manipulation etc. are described with examples too.
Class object method constructors in javaRaja Sekhar
Presented By :
N.V.Raja Sekhar Reddy
www.technolamp.co.in
www.programming9.com
Want more interesting...
Watch and Like us @ https://www.facebook.com/Technolamp.co.in
subscribe videos @ http://www.youtube.com/user/nvrajasekhar
Java is a programming language designed for use in the distributed environment of the Internet.
Programming language developed for the Web.
Programming language Developed by James Gosling.
Sun Microsystems released java in 1995 as a core component of Sun Java technology.
Java is very versatile, efficient, platform independent and secure.
Java is write once and run anywhere.
PHP is an acronym for "PHP: Hypertext Preprocessor"
PHP is a widely-used, open source scripting language
PHP scripts are executed on the server
PHP is free to download and use
SQL stands for Structured Query Language.
SQL is used to communicate with a database.
SQL statements are used to perform tasks such as update data on a database, or retrieve data from a database.
SQL commands are divided into several different types, among them data manipulation language (DML) and data definition language (DDL) statements, transaction controls and security measures.
Php my sql - functions - arrays - tutorial - programmerblog.netProgrammer Blog
In this ppt you will learn about functions and array in php. What are functions, how to declare and use. built in functions. include and required keywords. how are arguments used. how to create functions inside functions.
What are php arrays, how to create an array and use them. Built in array functions. What are super globals?
This is a presentation I did for the Cedar Rapids .NET User Group (CRineta.org). It was intended to present object oriented concepts and their application in .NET and C#.
Най-търсените направления в ИТ сферата за 2024Svetlin Nakov
Най-търсените направления в ИТ сферата?
д-р Светлин Наков, съосновател на СофтУни
София, май 2024 г.
Какво се случва на пазара на труда в ИТ сектора?
Какви са прогнозите за ИТ сектора за напред?
Защо има смисъл да учиш програмиране и ИТ през 2024?
Каква е ролята на AI в ИТ професиите?
Как да започна работа като junior?
Upskill програмите на СофтУни
BG-IT-Edu: отворено учебно съдържание за ИТ учителиSvetlin Nakov
Отворено учебно съдържание по програмиране и ИТ за учители
Безплатни учебни курсове и ресурси за ИТ учители
Разработени курсове към 03/2024 г. в BG-IT-Edu
https://github.com/BG-IT-Edu
Качествени учебни курсове (учебно съдържание) за ИТ учители: презентации + примери + упражнения + проекти + задачи за изпитване + judge система + насоки за учителите
Достъпни безплатно, под отворен лиценз CC-BY-NC-SA
Разработени от СофтУни Фондацията, по инициатива и под надзора на д-р Светлин Наков
Научете повече тук: https://nakov.com/blog/2024/03/27/bg-it-edu-open-education-content-for-it-teachers/
Светът на програмирането през 2024 г.
Продължава ли бумът на технологичните професии? Кои професии ще се търсят? Как да започна?
Прогнозата на д-р Светлин Наков за бъдещето на софтуерните професии в България
Има ли смисъл да учиш програмиране през 2024?
Какво се търси на пазара на труда?
Ще продължи ли търсенето на програмисти и през 2024?
Все още ли е най-търсената професия в технологиите?
Ролята на AI в сферата на софтуерните разработчици
Какво се случва на пазара на труда?
Има ли спад в търсенето на програмисти?
Как да започна с програмирането?
Видео от събитието сме качили във FB: https://fb.com/events/346653434644683
AI Tools for Business and Startups
Svetlin Nakov @ Innowave Summit 2023
Artificial Intelligence is already here!
AI Tools for Business: Where is AI Used?
ChatGPT and Bard in Daily Tasks
ChatGPT and Bard for Creativity
ChatGPT and Bard for Marketing
ChatGPT for Data Analysis
DALL-E for Image Generation
Learn more at: https://nakov.com/blog/2023/11/25/ai-for-business-and-startups-my-talk-at-innowave-summit-2023/
AI Tools for Scientists - Nakov (Oct 2023)Svetlin Nakov
Инструменти с изкуствен интелект в помощ на изследователите
Д-р Светлин Наков @ Anniversary Scientific Session dedicated to the 120th anniversary of the birth of John Atanasoff
Изкуствен интелект при стартиране и управление на бизнес
Семинар във FinanceAcademy.bg
Д-р Светлин Наков
Изкуственият интелект (ИИ) е вече тук!
Къде се ползва ИИ?
ChatGPT – демо
Bard – демо
Claude – демо
Bing Chat – демо
Perplexity – демо
Bing Image Create – демо
Bulgarian Tech Industry - Nakov at Dev.BG All in One Conference 2023Svetlin Nakov
IT industry in Bulgaria: key factors for success and the future. Deep tech, science, innovation, and education and how we can achieve more as an industry?
Dr. Svetlin Nakov
Innovation and Inspiration Manager @ SoftUni
Contents:
How big is the IT industry in Bulgaria?
Number of software professionals in Bulgaria: according to historical data from BASSCOM
Share of the software industry in GDP
Why does Bulgaria have such a successful IT industry?
Education for the tech industry: school education in software professions and profiles (2022/2023)
Education for the tech industry: Students in university in IT specialties (2022/2023)
Education for the IT industry: Learners at SoftUni (2022/2023)
Evolution of the Bulgarian software industry
How much can the industry grow?
Trends in the IT industry: AI progress, the IT market in Bulgaria, deep tech, science, and innovation
AI in the software industry
How to achieve more as an industry? education, deep tech, science, and innovation, entrepreneurship
Introduction
The IT industry in Bulgaria is one of the most successful in the country. It has grown rapidly in recent years and is now a major contributor to the economy. In this talk, Dr. Nakov explores the key factors behind the success of the Bulgarian IT industry, as well as its future prospects.
AI Tools for Business and Personal LifeSvetlin Nakov
A talk at LeaderClass.BG, Sofia, August 2023
by Svetlin Nakov, PhD
The artificial intelligence (AI) is here!
Where is AI used?
ChatGPT - demo
Bing Chat - demo
Bard - demo
Claude - demo
Bing Image Create - demo
Playground AI - demo
In this talk the speaker explains and demonstrates some AI tools for the business and personal life:
ChatGPT: a large language model that can generate text, translate languages, write different kinds of creative content, and answer your questions in an informative way.
Bing Chat: an Internet-connected AI chatbot that can search Internet and answer questions.
Bard: a large language model from Google AI, trained on a massive dataset of text and code, similar to ChatGPT.
Claude: A large AI chatbot, similar to ChatGPT, powerful in document analysis.
Bing Image Create: a tool that can generate images based on text descriptions.
Playground AI: image generator and image editor, based on generative AI.
Дипломна работа: учебно съдържание по ООП - Светлин НаковSvetlin Nakov
Дипломна работа на тема
"Учебно съдържание по обектно-ориентирано програмиране в профилираната подготовка по информатика"
Дипломант: д-р Светлин Наков
Специалност: Педагогика на обучението по информатика и информационни технологии в училище (ПОИИТУ)
Степен: магистър
Пловдивски университет "Паисий Хилендарски"
Факултет по математика и информатика (ФМИ)
Катедра “Компютърни технологии”
Настоящата дипломна работа има за цел да подпомогне българските ИТ учители от системата на средното образование в профилираните гимназии и паралелки, като им предостави безплатно добре разработени учебни програми и качествено учебно съдържание за преподаване в първия и най-важен модул от профил “Софтуерни и хардуерни науки”, а именно “Модул 1. Обектно-ориентирано проектиране и програмиране”.
Чрез изграждането на качествени учебни програми и ресурси за преподаване и пренасяне на добре изпитани образователни практики от автора на настоящата дипломна работа (д-р Светлин Наков) към българските ИТ учители целим значително да подпомогнем учителите в тяхната образователна кауза и да повишим качеството на обучението по програмиране в профилираните гимназии с профил “Софтуерни и хардуерни науки”.
Резултатите от настоящата дипломна работа са вече внедрени в практиката и разработените учебни ресурси се използват реално от стотици ИТ учители в България в ежедневната им работа. Това е една от основните цели и тя вече е изпълнена, още преди защитата на настоящата дипломна работа.
Прочетете повече в блога на д-р Наков: https://nakov.com/blog/2023/07/08/free-learning-content-oop-nakov/
Дипломна работа: учебно съдържание по ООПSvetlin Nakov
Презентация за защита на
Дипломна работа на тема
"Учебно съдържание по обектно-ориентирано програмиране в профилираната подготовка по информатика"
Дипломант: д-р Светлин Наков
Пловдивски университет "Паисий Хилендарски"
Факултет по математика и информатика (ФМИ)
Катедра “Компютърни технологии”
Защитена на: 8 юли 2023 г.
Научете повече в блога на д-р Наков: https://nakov.com/blog/2023/07/08/free-learning-content-oop-nakov
Свободно ИТ учебно съдържание за учители по програмиране и ИТSvetlin Nakov
В тази сесия разказвам за училищното образование по програмиране и ИТ, за професионалните и профилираните гимназии, свързани с програмиране и ИТ, за STEM кабинетите, за българските ИТ учители и тяхната подготовка, за проблемите, с които те се сблъскват, и как можем да им помогнем чрез проекта „Свободно учебно съдържание по програмиране и ИТ“: https://github.com/BG-IT-Edu.
Open Fest 2021, 14 август, София
В света се засилва тенденцията за установяване на STEAM образованието като двигател на научно-техническия прогрес чрез развитие на интердисциплинарни умения в сферата на природните науки, математиката, информационните технологии, инженерните науки и изкуствата в училищна възраст. С масовото изграждане на STEAM лаборатории в българските училища се изостря недостига на добре подготвени STEAM и ИТ учители.
Вярвайки в идеята, че българската ИТ общност може да помогне за решаването на проблема, през 2020 г. по инициатива на СофтУни Фондацията стартира проект за създаване на безплатно учебно съдържание по програмиране и ИТ за учители в подкрепа на училищното технологично образование. Проектът е със свободен лиценз в GitHub: https://github.com/BG-IT-Edu. Учителите получават безплатно богат комплект от съвременни учебни материали с високо качество: презентации, постъпкови ръководства, задачи за упражнения и практически проекти, окомплектовани с насоки, подсказки и решения, безплатна система за автоматизирано тестване на решенията и други учебни ресурси, на български и английски език.
Създадени са голяма част от учебните курсове за професиите "Приложен програмист", "Системен програмист" и "Програмист" в професионалните гимназии. Амбицията на проекта е да се създадат свободни учебни материали и за обученията в профил "Софтуерни и хардуерни науки" в профилираните гимназии.
Целта на проекта “Свободно ИТ учебно съдържание за учители” е да подпомогне българския ИТ учител с качествени учебни материали, така че да преподава на добро ниво и със съвременни технологии и инструменти, за да положи основите на подготовката на бъдещите ИТ специалисти и дигитални лидери на България.
В лекцията разказвам за училищното образование по програмиране и ИТ, за професионалните и профилираните гимназии, свързани с програмиране и ИТ, за STEM кабинетите, за българските ИТ учители и тяхната подготовка, за проблемите с които те се срещат, за липсата на учебници и учебни материали по програмиране, ИТ и по техническите дисциплини и как можем да помогнем на ИТ учителите.
A public talk "AI and the Professions of the Future", held on 29 April 2023 in Veliko Tarnovo by Svetlin Nakov. Main topics:
AI is here today --> take attention to it!
- ChatGPT: revolution in language AI
- Playground AI – AI for image generation
AI and the future professions
- AI-replaceable professions
- AI-resistant professions
AI in Education
Ethics in AI
In this seminar Dr. Svetlin Nakov talks about the programming languages, their popularity, available jobs and trends for 2022-2023.
Modern software development uses dozens of programming languages, along with hundreds of technology frameworks, libraries, and software tools.
This talk will review the most popular programming languages on the labor market: JavaScript, Java, C#, Python, PHP, C++, Go, Swift. It will be briefly stated what each of them is, what it is used for and what is its demand in the IT industry.
Agenda:
The Most Used Programming Languages in 2022:
- Python, Java, JavaScript, C#, C++, PHP
Jobs by Programming Languages in 2022:
- Jobs Worldwide by Programming Language
- Jobs in Bulgaria by Programming Language
Programming Languages Trends for 2023
- Language Popularity Rankings from Stack Overflow, GitHub, PYPL, IEEE, TIOBE, Etc.
Become a Software Developer: How To Start?
IT Professions and How to Become a DeveloperSvetlin Nakov
IT Professions and Their Future
The landscape of IT professions in the tech industry: software developer, front-end, back-end, AI, cloud, DevOps, QA, Java, JavaScript, Python, C#, C++, digital marketing, SEO, SEM, SMM, project manager, business analyst, CRM / ERP consultant, design / UI / UX expert, Web designer, motion designer, etc.
Industry 4.0 and the future of manufacturing, smart cities and digitalization of everything.
What are the most in-demand professions on LinkedIn? Why the best jobs in the world are related to software development and IT?
How to learn coding and start a tech job?
Why anyone can be a software developer?
Dr. Svetlin Nakov
December 2022
GitHub Actions (Nakov at RuseConf, Sept 2022)Svetlin Nakov
Building a CI/CD System with GitHub Actions
Dr. Svetlin Nakov
September 2022
Intro to Continuous Integration (CI), Continuous Delivery (CD), Continuous Deployment (CD), and CI/CD Pipelines
Intro to GitHub Actions
Building CI workflow
Building CD workflow
Live Demo: Build CI System for JS and .NET Apps
How to Become a QA Engineer and Start a JobSvetlin Nakov
How to Become a QA Engineer and Start a Job
Svetlin Nakov, PhD
Sofia, Nov, 2022
1) Why Become а QA Engineer?
2) How to Become a Software Quality Assurance Engineer (QA)?
Learn the Fundamental QA Skills:
Manual QA skills – 30%
Software engineering skills – 20%
QA automation skills – 50%
3) Anyone Can Be a QA Engineer!
4) The QA Program @ SoftUni
https://softuni.bg/qa
Призвание и цели: моята рецепта
д-р Светлин Наков
Как да открия своето призвание в живота и да го направя своя професия?
Съдържание:
1) Светлин Наков - моята история
2) Дигиталните професии
3) Как да намеря своята професия?
Поход на вдъхновителите | Аз мога тук и сега @ Петрич (19 ноември 2022 г.)
What Mongolian IT Industry Can Learn from Bulgaria?Svetlin Nakov
In this talk the speaker Dr. Svetlin Nakov explains the growth of the Bulgarian software industry for the latest 25 years and the key events in its growth.
He gives rich statistical data about Bulgaria, its GDP, and its software industry, which generates nearly 5% of the GDP (in 2022), about the open developer positions (5K in Oct 2022) and the number of software developers in Bulgaria (54K in Oct 2022).
The growth of the number of software developers in Bulgaria, software industry's revenues and their share in the national GDP are traced back from 2022 to 2005.
Similar research about the Mongolian software industry is conducted and available data is compared to Bulgaria and USA.
An interesting parallel is given between Bulgaria and Mongolia in terms of their software engineering talent and industry growth potential.
Finally, Dr. Nakov gives his recommendations about how local Mongolian software companies can reach the global tech market and suggests to use the "outstaffing" business model, targeting the European tech industry and the Asian region.
The talk is given at the "The Future of IT" forum in Ulaanbaatar, Mongolia (October 2022).
How to Become a Software Developer - Nakov in Mongolia (Oct 2022)Svetlin Nakov
In this talk the speaker Svetlin Nakov explains the IT professions and their extremely high demand in the latest years, and gives a recipe how to become a software engineer.
He recommends to spend 1-2 years in studying and practicing software engineering, following a learning curriculum like this:
Basic Coding Course – calculations, data, conditions, loops, IDE
Fundamentals of Programming – arrays, lists, maps, nested structures, text processing, error handling, basic language APIs, problem solving
Object-Oriented Programming – classes, objects, inheritance, …
Databases and ORM – relational DB, SQL, ORM frameworks, XML, JSON
Back-End Development – HTTP, MVC, Web apps, REST
Front-End Development – HTML, CSS, JS, DOM, AJAX, JS Frameworks
Projects – Git, software engineering, teamwork
Example: https://softuni.org/learn
The talk is from the "The Future of IT" forum in Ulaanbaatar, Mongolia (October 2022).
Unlocking Productivity: Leveraging the Potential of Copilot in Microsoft 365, a presentation by Christoforos Vlachos, Senior Solutions Manager – Modern Workplace, Uni Systems
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.
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.
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.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...Neo4j
Leonard Jayamohan, Partner & Generative AI Lead, Deloitte
This keynote will reveal how Deloitte leverages Neo4j’s graph power for groundbreaking digital twin solutions, achieving a staggering 100x performance boost. Discover the essential role knowledge graphs play in successful generative AI implementations. Plus, get an exclusive look at an innovative Neo4j + Generative AI solution Deloitte is developing in-house.
Communications Mining Series - Zero to Hero - Session 1DianaGray10
This session provides introduction to UiPath Communication Mining, importance and platform overview. You will acquire a good understand of the phases in Communication Mining as we go over the platform with you. Topics covered:
• Communication Mining Overview
• Why is it important?
• How can it help today’s business and the benefits
• Phases in Communication Mining
• Demo on Platform overview
• Q/A
Pushing the limits of ePRTC: 100ns holdover for 100 daysAdtran
At WSTS 2024, Alon Stern explored the topic of parametric holdover and explained how recent research findings can be implemented in real-world PNT networks to achieve 100 nanoseconds of accuracy for up to 100 days.
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.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
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.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
4. What is Class?
The formal definition of class:
Definition by Google
4
Classes act as templates from which an
instance of an object is created at run
time. Classes define the properties of the
object and the methods used to control
the object's behavior.
5. Classes
Classes provide the structure for objects
Define their prototype, act as template
Classes define:
Set of attributes
Represented by fields and properties
Hold their state
Set of actions (behavior)
Represented by methods
A class defines the methods and types of data
associated with an object
5
6. Classes – Example
6
Account
+Owner: Person
+Ammount: double
+Suspend()
+Deposit(sum:double)
+Withdraw(sum:double)
Class Name Attributes
(Properties
and Fields)
Operations
(Methods)
7. Objects
An object is a concrete instance of a particular
class
Creating an object from a class is called
instantiation
Objects have state
Set of values associated to their attributes
Example:
Class: Account
Objects: Ivan's account, Peter's account
7
8. Objects – Example
8
Account
+Owner: Person
+Ammount: double
+Suspend()
+Deposit(sum:double)
+Withdraw(sum:double)
Class ivanAccount
+Owner="Ivan Kolev"
+Ammount=5000.0
peterAccount
+Owner="Peter Kirov"
+Ammount=1825.33
kirilAccount
+Owner="Kiril Kirov"
+Ammount=25.0
Object
Object
Object
9. Classes in C#
Basic units that compose programs
Implementation is encapsulated (hidden)
Classes in C# can contain:
Fields (member variables)
Properties
Methods
Constructors
Inner types
Etc. (events, indexers, operators, …)
9
10. Classes in C# – Examples
Example of classes:
System.Console
System.String (string in C#)
System.Int32 (int in C#)
System.Array
System.Math
System.Random
10
11. Declaring Objects
An instance of a class or structure can be
defined like any other variable:
Instances cannot be used if they are
not initialized
11
using System;
...
// Define two variables of type DateTime
DateTime today;
DateTime halloween;
// Declare and initialize a structure instance
DateTime today = DateTime.Now;
12. Fields
Fields are data members of a class
Can be variables and constants
Accessing a field doesn’t invoke any actions of
the object
Example:
String.Empty (the "" string)
12
13. Accessing Fields
Constant fields can be only read
Variable fields can be read and modified
Usually properties are used instead of directly
accessing variable fields
Examples:
13
// Accessing read-only field
String empty = String.Empty;
// Accessing constant field
int maxInt = Int32.MaxValue;
14. Properties
Properties look like fields (have name and
type), but they can contain code, executed
when they are accessed
Usually used to control access to data
fields (wrappers), but can contain more
complex logic
Can have two components (and at least one
of them) called accessors
get for reading their value
set for changing their value
14
15. Properties (2)
According to the implemented accessors
properties can be:
Read-only (get accessor only)
Read and write (both get and set accessors)
Write-only (set accessor only)
Example of read-only property:
String.Length
15
16. Accessing Properties and
Fields – Example
16
using System;
...
DateTime christmas = new DateTime(2009, 12, 25);
int day = christmas.Day;
int month = christmas.Month;
int year = christmas.Year;
Console.WriteLine(
"Christmas day: {0}, month: {1}, year: {2}",
day, month, year);
Console.WriteLine(
"Day of year: {0}", christmas.DayOfYear);
Console.WriteLine("Is {0} leap year: {1}",
year, DateTime.IsLeapYear(year));
17. Instance and Static Members
Fields, properties and methods can be:
Instance (or object members)
Static (or class members)
Instance members are specific for each object
Example: different dogs have different name
Static members are common for all instances
of a class
Example: DateTime.MinValue is shared
between all instances of DateTime
17
18. Instance and Static
Members – Examples
Example of instance member
String.Length
Each string object has different length
Example of static member
Console.ReadLine()
The console is only one (global for the program)
Reading from the console does not require to
create an instance of it
18
19. Methods
Methods manipulate the data of the object to
which they belong or perform other tasks
Examples:
Console.WriteLine(…)
Console.ReadLine()
String.Substring(index, length)
Array.GetLength(index)
19
20. Instance Methods
Instance methods manipulate the data of a
specified object or perform any other tasks
If a value is returned, it depends on the
particular class instance
Syntax:
The name of the instance, followed by the
name of the method, separated by dot
20
<object_name>.<method_name>(<parameters>)
22. Static Methods
Static methods are common for all instances of
a class (shared between all instances)
Returned value depends only on the passed
parameters
No particular class instance is available
Syntax:
The name of the class, followed by the name of
the method, separated by dot
22
<class_name>.<method_name>(<parameters>)
24. Constructors
Constructors are special methods used to
assign initial values of the fields in an object
Executed when an object of a given type is
being created
Have the same name as the class that holds
them
Do not return a value
A class may have several constructors with
different set of parameters
24
25. Constructors (2)
Constructor is invoked by the new operator
Examples:
25
String s = new String("Hello!"); // s = "Hello!"
<instance_name> = new <class_name>(<parameters>)
String s = new String('*', 5); // s = "*****"
DateTime dt = new DateTime(2009, 12, 30);
DateTime dt = new DateTime(2009, 12, 30, 12, 33, 59);
Int32 value = new Int32(1024);
26. Structures
Structures are similar to classes
Structures are usually used for storing data
structures, without any other functionality
Structures can have fields, properties, etc.
Using methods is not recommended
Structures are value types, and classes are
reference types (this will be discussed later)
Example of structure
System.DateTime – represents a date and time
26
27. Enumerations
Enumerations in C# are types whose values are
limited to a predefined set of values
E.g. the days of week
Declared by the keyword enum in C#
Hold values from a predefined set
27
public enum Color { Red, Green, Blue, Black }
…
Color color = Color.Red;
Console.WriteLine(color); // Red
color = 5; // Compilation error!
28. What is a Namespace?
Namespaces are used to organize the source
code into more logical and manageable way
Namespaces can contain
Definitions of classes, structures, interfaces and
other types and other namespaces
Namespaces can contain other namespaces,
e.g.
System namespace contains Data namespace
The name of the nested namespace is
System.Data
28
29. Full Class Names
A full name of a class is the name of the class
preceded by the name of its namespace
Example:
Array class, defined in the System namespace
The full name of the class is System.Array
29
<namespace_name>.<class_name>
30. Including Namespaces
The using directive in C#:
Allows using types in a namespace, without
specifying their full name
Example:
instead of
30
using <namespace_name>
using System;
DateTime date;
System.DateTime date;
31. CommonType System (CTS)
CTS defines all data types supported in .NET
Framework
Primitive types (e.g. int, float, object)
Classes (e.g. String, Console, Array)
Structures (e.g. DateTime)
Arrays (e.g. int[], string[,])
Etc.
Object-oriented by design
31
32. CTS and Different Languages
CTS is common for all .NET languages
C#,VB.NET, J#, JScript.NET, ...
CTS type mappings:
32
CTS Type C# Type VB.NET Type
System.Int32 int Integer
System.Single float Single
System.Boolean bool Boolean
System.String string String
System.Object object Object
33. Value and ReferenceTypes
In CTS there are two categories of types
Value types
Reference types
Placed in different areas of memory
Value types live in the execution stack
Freed when become out of scope
Reference types live in the managed heap
(dynamic memory)
Freed by the garbage collector
33
34. Value and Reference
Types – Examples
Value types
Most of the primitive types
Structures
Examples: int, float, bool, DateTime
Reference types
Classes and interfaces
Strings
Arrays
Examples: string, Random, object, int[]
34
36. What are Exceptions?
The exceptions in .NET Framework are classic
implementation of the OOP exception model
Deliver powerful mechanism for centralized
handling of errors and unusual events
Substitute procedure-oriented approach,
in which each function returns error code
Simplify code construction and maintenance
Allow the problematic situations to be
processed at multiple levels
36
37. Handling Exceptions
In C# the exceptions can be handled by the
try-catch-finally construction
catch blocks can be used multiple times to
process different exception types
37
try
{
// Do some work that can raise an exception
}
catch (SomeException)
{
// Handle the caught exception
}
38. Handling Exceptions – Example
38
static void Main()
{
string s = Console.ReadLine();
try
{
Int32.Parse(s);
Console.WriteLine(
"You entered valid Int32 number {0}.", s);
}
catch (FormatException)
{
Console.WriteLine("Invalid integer number!");
}
catch (OverflowException)
{
Console.WriteLine(
"The number is too big to fit in Int32!");
}
}
39. The System.Exception Class
Exceptions in .NET are objects
The System.Exception class is base for all
exceptions in CLR
Holds information for the cause of the error or
the unusual situation
Message – text description of the exception
StackTrace – the snapshot of the stack at the
moment of exception throwing
InnerException – exception caused the current
exception (if any)
39
41. Exception Properties
The Message property gives brief description of the
problem
The StackTrace property is extremely useful when
identifying the reason caused the exception
41
Exception caught: Input string was not in a correct
format.
at System.Number.ParseInt32(String s, NumberStyles
style, NumberFormatInfo info)
at System.Int32.Parse(String s)
at ExceptionsTest.CauseFormatException() in
c:consoleapplication1exceptionstest.cs:line 8
at ExceptionsTest.Main(String[] args) in
c:consoleapplication1exceptionstest.cs:line 15
42. Exception Properties (2)
File names and line numbers are accessible only if the
compilation was in Debug mode
When compiled in Release mode, the information in
the property StackTrace is quite different:
42
Exception caught: Input string was not in a correct
format.
at System.Number.ParseInt32(String s, NumberStyles
style, NumberFormatInfo info)
at ExceptionsTest.Main(String[] args)
44. Types of Exceptions
All .NET exceptions inherit from System.Exception
The system exceptions inherit from
System.SystemException, e.g.
System.ArgumentException
System.NullReferenceException
System.OutOfMemoryException
System.StackOverflowException
User-defined exceptions should inherit from
System.ApplicationException
44
45. Handling Exceptions
When catching an exception of a particular class, all
its inheritors (child exceptions) are caught too
Example:
Handles ArithmeticException and its successors
DivideByZeroException and OverflowException
45
try
{
// Do some works that can raise an exception
}
catch (System.ArithmeticException)
{
// Handle the caught arithmetic exception
}
46. Handling All Exceptions
All exceptions thrown by .NET managed code
inherit the System.Exception exception
Unmanaged code can throw other exceptions
For handling all exceptions (even unmanaged)
use the construction:
46
try
{
// Do some works that can raise any exception
}
catch
{
// Handle the caught exception
}
47. Throwing Exceptions
Exceptions are thrown (raised) by throw
keyword in C#
Used to notify the calling code in case of error
or unusual situation
When an exception is thrown:
The program execution stops
The exception travels over the stack until a
suitable catch block is reached to handle it
Unhandled exceptions display error message
47
49. Using throw Keyword
Throwing an exception with error message:
Exceptions can take message and cause:
Note: if the original exception is not passed the
initial cause of the exception is lost
49
throw new ArgumentException("Invalid amount!");
try
{
Int32.Parse(str);
}
catch (FormatException fe)
{
throw new ArgumentException("Invalid number", fe);
}
50. Throwing Exceptions – Example
50
public static double Sqrt(double value)
{
if (value < 0)
throw new System.ArgumentOutOfRangeException(
"Sqrt for negative numbers is undefined!");
return Math.Sqrt(value);
}
static void Main()
{
try
{
Sqrt(-1);
}
catch (ArgumentOutOfRangeException ex)
{
Console.Error.WriteLine("Error: " + ex.Message);
throw;
}
}
52. What Is String?
Strings are sequences of characters
Each character is a Unicode symbol
Represented by the string data type in C#
(System.String)
Example:
52
string s = "Hello, C#";
H e l l o , C #s
53. The System.String Class
Strings are represented by System.String
objects in .NET Framework
String objects contain an immutable (read-only)
sequence of characters
Strings use Unicode in to support multiple
languages and alphabets
Strings are stored in the dynamic memory
(managed heap)
System.String is reference type
53
54. The System.String Class (2)
String objects are like arrays of characters
(char[])
Have fixed length (String.Length)
Elements can be accessed directly by index
The index is in the range [0...Length-1]
54
string s = "Hello!";
int len = s.Length; // len = 6
char ch = s[1]; // ch = 'e'
0 1 2 3 4 5
H e l l o !
index =
s[index] =
55. Strings – Example
55
static void Main()
{
string s =
"Stand up, stand up, Balkan Superman.";
Console.WriteLine("s = "{0}"", s);
Console.WriteLine("s.Length = {0}", s.Length);
for (int i = 0; i < s.Length; i++)
{
Console.WriteLine("s[{0}] = {1}", i, s[i]);
}
}
56. Declaring Strings
There are two ways of declaring string
variables:
Using the C# keyword string
Using the .NET's fully qualified class name
System.String
The above three declarations are equivalent
56
string str1;
System.String str2;
String str3;
57. Creating Strings
Before initializing a string variable has null
value
Strings can be initialized by:
Assigning a string literal to the string variable
Assigning the value of another string variable
Assigning the result of operation of type string
57
58. Creating Strings (2)
Not initialized variables has value of null
Assigning a string literal
Assigning from another string variable
Assigning from the result of string operation
58
string s; // s is equal to null
string s = "I am a string literal!";
string s2 = s;
string s = 42.ToString();
59. Reading and Printing Strings
Reading strings from the console
Use the method Console.ReadLine()
59
string s = Console.ReadLine();
Console.Write("Please enter your name: ");
string name = Console.ReadLine();
Console.Write("Hello, {0}! ", name);
Console.WriteLine("Welcome to our party!");
Printing strings to the console
Use the methodsWrite() and WriteLine()
60. Comparing Strings
A number of ways exist to compare two
strings:
Dictionary-based string comparison
Case-insensitive
Case-sensitive
60
int result = string.Compare(str1, str2, true);
// result == 0 if str1 equals str2
// result < 0 if str1 if before str2
// result > 0 if str1 if after str2
string.Compare(str1, str2, false);
61. Comparing Strings – Example
Finding the first string in a lexicographical order
from a given list of strings:
61
string[] towns = {"Sofia", "Varna", "Plovdiv",
"Pleven", "Bourgas", "Rousse", "Yambol"};
string firstTown = towns[0];
for (int i=1; i<towns.Length; i++)
{
string currentTown = towns[i];
if (String.Compare(currentTown, firstTown) < 0)
{
firstTown = currentTown;
}
}
Console.WriteLine("First town: {0}", firstTown);
62. Concatenating Strings
There are two ways to combine strings:
Using the Concat() method
Using the + or the += operators
Any object can be appended to a string
62
string str = String.Concat(str1, str2);
string str = str1 + str2 + str3;
string str += str1;
string name = "Peter";
int age = 22;
string s = name + " " + age; // "Peter 22"
63. Searching in Strings
Finding a character or substring within given
string
First occurrence
First occurrence starting at given position
Last occurrence
63
IndexOf(string str)
IndexOf(string str, int startIndex)
LastIndexOf(string)
64. Searching in Strings – Example
64
string str = "C# Programming Course";
int index = str.IndexOf("C#"); // index = 0
index = str.IndexOf("Course"); // index = 15
index = str.IndexOf("COURSE"); // index = -1
// IndexOf is case-sensetive. -1 means not found
index = str.IndexOf("ram"); // index = 7
index = str.IndexOf("r"); // index = 4
index = str.IndexOf("r", 5); // index = 7
index = str.IndexOf("r", 8); // index = 18
0 1 2 3 4 5 6 7 8 9 10 11 12 13 …
C # P r o g r a m m i n g …
index =
s[index] =
65. Extracting Substrings
Extracting substrings
str.Substring(int startIndex, int length)
str.Substring(int startIndex)
65
string filename = @"C:PicsRila2009.jpg";
string name = filename.Substring(8, 8);
// name is Rila2009
string filename = @"C:PicsSummer2009.jpg";
string nameAndExtension = filename.Substring(8);
// nameAndExtension is Summer2009.jpg
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
C : P i c s R i l a 2 0 0 5 . j p g
66. Splitting Strings
To split a string by given separator(s) use the
following method:
Example:
66
string[] Split(params char[])
string listOfBeers =
"Amstel, Zagorka, Tuborg, Becks.";
string[] beers =
listOfBeers.Split(' ', ',', '.');
Console.WriteLine("Available beers are:");
foreach (string beer in beers)
{
Console.WriteLine(beer);
}
67. Replacing and Deleting Substrings
Replace(string, string) – replaces all
occurrences of given string with another
The result is new string (strings are immutable)
Remove(index, length) – deletes part of a string
and produces a new string as result
67
string cocktail = "Vodka + Martini + Cherry";
string replaced = cocktail.Replace("+", "and");
// Vodka and Martini and Cherry
string price = "$ 1234567";
string lowPrice = price.Remove(2, 3);
// $ 4567
69. Trimming White Space
Using method Trim()
Using method Trim(chars)
Using TrimStart() and TrimEnd()
69
string s = " example of white space ";
string clean = s.Trim();
Console.WriteLine(clean);
string s = " tnHello!!! n";
string clean = s.Trim(' ', ',' ,'!', 'n','t');
Console.WriteLine(clean); // Hello
string s = " C# ";
string clean = s.TrimStart(); // clean = "C# "
70. Constructing Strings
Strings are immutable
Concat(), Replace(), Trim(), ... return new
string, do not modify the old one
Do not use "+" for strings in a loop!
It runs very, very inefficiently (slowly)!
70
public static string DupChar(char ch, int count)
{
string result = "";
for (int i=0; i<count; i++)
result += ch;
return result;
}
Very bad practice.
Avoid this!
71. Changing the Contents of a
String – StringBuilder
Use the System.Text.StringBuilder class for
modifiable strings of characters:
Use StringBuilder if you need to keep adding
characters to a string
71
public static string ReverseString(string s)
{
StringBuilder sb = new StringBuilder();
for (int i = s.Length-1; i >= 0; i--)
sb.Append(s[i]);
return sb.ToString();
}
72. The StringBuilder Class
StringBuilder keeps a buffer memory,
allocated in advance
Most operations use the buffer memory and
do not allocate new objects
72
H e l l o , C # !StringBuilder:
Length=9
Capacity=15
Capacity
used buffer
(Length)
unused
buffer
73. StringBuilder – Example
Extracting all capital letters from a string
73
public static string ExtractCapitals(string s)
{
StringBuilder result = new StringBuilder();
for (int i = 0; i<s.Length; i++)
{
if (Char.IsUpper(s[i]))
{
result.Append(s[i]);
}
}
return result.ToString();
}
74. Method ToString()
All classes have public virtual method
ToString()
Returns a human-readable, culture-sensitive
string representing the object
Most .NET Framework types have own
implementation of ToString()
int, float, bool, DateTime
74
int number = 5;
string s = "The number is " + number.ToString();
Console.WriteLine(s); // The number is 5
75. Method ToString(format)
We can apply specific formatting when
converting objects to string
ToString(formatString) method
75
int number = 42;
string s = number.ToString("D5"); // 00042
s = number.ToString("X"); // 2A
// Consider the default culture is Bulgarian
s = number.ToString("C"); // 42,00 лв
double d = 0.375;
s = d.ToString("P2"); // 37,50 %
76. Formatting Strings
The formatting strings are different for the
different types
Some formatting strings for numbers:
D – number (for integer types)
C – currency (according to current culture)
E – number in exponential notation
P – percentage
X – hexadecimal number
F – fixed point (for real numbers)
76
77. Method String.Format()
Applies templates for formatting strings
Placeholders are used for dynamic text
Like Console.WriteLine(…)
77
string template = "If I were {0}, I would {1}.";
string sentence1 = String.Format(
template, "developer", "know C#");
Console.WriteLine(sentence1);
// If I were developer, I would know C#.
string sentence2 = String.Format(
template, "elephant", "weigh 4500 kg");
Console.WriteLine(sentence2);
// If I were elephant, I would weigh 4500 kg.
78. Composite Formatting
The placeholders in the composite formatting
strings are specified as follows:
Examples:
78
{index[,alignment][:formatString]}
double d = 0.375;
s = String.Format("{0,10:F5}", d);
// s = " 0,37500"
int number = 42;
Console.WriteLine(
"Dec {0:D} = Hex {1:X}", number, number);
// Dec 42 = Hex 2A
79. Formatting Dates
Dates use their own formatting strings
d, dd – day (with/without leading zero)
M, MM – month
yy, yyyy – year (2 or 4 digits)
h, hh, m, mm, s, ss – hour, minute, second
79
DateTime now = DateTime.Now;
Console.WriteLine(
"Now is {0:d.MM.yyyy hh:mm:ss}", now);
// Now is 31.11.2009 11:30:32
81. What are Generics?
Generics allow defining parameterized classes
that process data of unknown (generic) type
The class can be instantiated with several
different particular types
Example: List<T> List<int> /
List<string> / List<Student>
Generics are also known as "parameterized
types" or "template types"
Similar to the templates in C++
Similar to the generics in Java
81
82. The List<T> Class
Implements the abstract data structure list
using an auto-extensible array
All elements are of the same type T
T can be any type, e.g. List<int>,
List<string>, List<DateTime>
Size is dynamically increased as needed
Basic functionality:
Count – returns the number of elements
Add(T) – appends given element at the end
82
83. List<T> – Simple Example
83
static void Main()
{
List<string> list = new List<string>();
list.Add("C#");
list.Add("Java");
list.Add("PHP");
foreach (string item in list)
{
Console.WriteLine(item);
}
// Result:
// C#
// Java
// PHP
}
84. List<T> – Functionality
list[index] – access element by index
Insert(index, T) – inserts given element to the
list at a specified position
Remove(T) – removes the first occurrence of
given element
RemoveAt(index) – removes the element at the
specified position
Clear() – removes all elements
Contains(T) – determines whether an element
is part of the list
84
85. List<T> – Functionality (2)
IndexOf() – returns the index of the first
occurrence of a value in the list (zero-based)
Reverse() – reverses the order of the elements in
the list or a portion of it
Sort() – sorts the elements in the list or a
portion of it
ToArray() – converts the elements of the list to
an array
TrimExcess() – sets the capacity to the actual
number of elements
85
86. Primes in an Interval – Example
86
static List<int> FindPrimes(int start, int end)
{
List<int> primesList = new List<int>();
for (int num = start; num <= end; num++)
{
bool prime = true;
for (int div = 2; div <= Math.Sqrt(num); div++)
{
if (num % div == 0)
{
prime = false;
break;
}
}
if (prime)
{
primesList.Add(num);
}
}
return primesList;
}
87. The Stack<T> Class
Implements the stack data structure using an
array
Elements are of the same type T
T can be any type, e.g. Stack<int>
Size is dynamically increased as needed
Basic functionality:
Push(T) – inserts elements to the stack
Pop() – removes and returns the top element
from the stack
87
88. Stack<T> – Example
Using Push(), Pop() and Peek() methods
88
static void Main()
{
Stack<string> stack = new Stack<string>();
stack.Push("1. Ivan");
stack.Push("2. Nikolay");
stack.Push("3. Maria");
stack.Push("4. George");
Console.WriteLine("Top = {0}", stack.Peek());
while (stack.Count > 0)
{
string personName = stack.Pop();
Console.WriteLine(personName);
}
}
89. The Queue<T> Class
Implements the queue data structure using a
circular resizable array
Elements are from the same type T
T can be any type, e.g. Stack<int>
Size is dynamically increased as needed
Basic functionality:
Enqueue(T) – adds an element to the end of
the queue
Dequeue() – removes and returns the
element at the beginning of the queue
89
90. Queue<T> – Example
Using Enqueue() and Dequeue() methods
90
static void Main()
{
Queue<string> queue = new Queue<string>();
queue.Enqueue("Message One");
queue.Enqueue("Message Two");
queue.Enqueue("Message Three");
queue.Enqueue("Message Four");
while (queue.Count > 0)
{
string message = queue.Dequeue();
Console.WriteLine(message);
}
}
91. Dictionary<TKey,TValue> Class
Implements the abstract data type
"Dictionary" as hash table
Size is dynamically increased as needed
Contains a collection of key-value pairs
arranged by the hash code of the key:
h(key) = value
Collisions are resolved by chaining
Dictionary<TKey,TValue> class relies on
Object.Equals() method for comparing the
elements
91
92. Dictionary<TKey,TValue>
Class (2)
Object.GetHashCode() method for
calculating the hash codes of the elements
Major operations:
Add(TKey,TValue) – adds an element
with the specified key and value into the
dictionary
Remove(TKey) – removes the element with
the specified key
Clear() – removes all elements
this[] – returns element by key
92
93. Dictionary<TKey,TValue>
Class (3)
Count – returns the number of elements
ContainsKey(TKey) – determines whether
the dictionary contains given key
ContainsValue(TValue) – determines
whether the dictionary contains given value
Keys – returns a collection of the keys
Values – returns a collection of the values
TryGetValue(TKey,out TValue) – if the key
is found, returns it in the TValue, otherwise
returns the default value for the TValue type
93
94. Dictionary<TKey,TValue> –
Example
94
Dictionary<string, int> studentsMarks =
new Dictionary<string, int>();
studentsMarks.Add("Ivan", 4);
studentsMarks.Add("Peter", 6);
studentsMarks.Add("Maria", 6);
studentsMarks.Add("George", 5);
int peterMark = studentsMarks["Peter"];
Console.WriteLine("Peter's mark: {0}", peterMark);
Console.WriteLine("Is Peter in the hash table: {0}",
studentsMarks.ContainsKey("Peter"));
Console.WriteLine("Students and grades:");
foreach (var pair in studentsMarks)
{
Console.WriteLine("{0} --> {1} ", pair.Key, pair.Value);
}
95. Counting Words in GivenText
95
string text = "Welcome to our C# course. In this " +
"course you will learn how to write simple " +
"programs in C# and Microsoft .NET";
string[] words = text.Split(new char[] {' ', ',', '.'},
StringSplitOptions.RemoveEmptyEntries);
var wordsCount = new Dictionary<string, int>();
foreach (string word in words)
{
if (wordsCount.ContainsKey(word))
wordsCount[word]++;
else
wordsCount.Add(word, 1);
}
foreach (var pair in wordsCount)
{
Console.WriteLine("{0} --> {1}", pair.Key, pair.Value);
}
96. BalancedTrees in .NET
Balanced Binary SearchTrees
Ordered binary search trees that have height of
log2(n) where n is the number of their nodes
Searching costs about log2(n) comparisons
.NET Framework has built-in implementations
of balanced search trees, e.g.:
SortedDictionary<K,V>
Red-black tree based map of key-value pairs
External libraries like "Wintellect Power
Collections for .NET" are more flexible
96
97. Sorted Dictionary – Example
97
string text = "Welcome to our C# course. In this " +
"course you will learn how to write simple " +
"programs in C# and Microsoft .NET";
string[] words = text.Split(new char[] {' ', ',', '.'},
StringSplitOptions.RemoveEmptyEntries);
var wordsCount = new SortedDictionary<string, int>();
foreach (string word in words)
{
if (wordsCount.ContainsKey(word))
wordsCount[word]++;
else
wordsCount.Add(word, 1);
}
foreach (var pair in wordsCount)
{
Console.WriteLine("{0} --> {1}", pair.Key, pair.Value);
}
99. What Are Attributes?
Attributes are special declarative tags
Used for attaching descriptive information
(annotations) to the declarations in the code
At compile time attributes are saved in the
assembly's metadata
Can be extracted from the metadata at run-
time and can be manipulated by different tools
Instances of classes derived from
System.Attribute
99
100. Attributes Applying – Example
Attribute's name is surrounded by square
brackets and is placed before the declaration
which it refers to:
[Flags] attribute indicates that the enum
type can be treated like a set of bit flags
100
[Flags] // System.FlagsAttribute
public enum FileAccess
{
Read = 1,
Write = 2,
ReadWrite = Read | Write
}
101. Attributes With Parameters
Attributes use parameters for initialization:
In this example the [DllImport] attribute is
instantiated by the compiler
A System.Runtime.InteropServices.
DllImportAttribute object is created,
initialized and put into the assembly metadata
101
[DllImport("user32.dll", EntryPoint="MessageBox")]
public static extern int ShowMessageBox(int hWnd,
string text, string caption, int type);
…
ShowMessageBox(0, "Some text", "Some caption", 0);
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*