This document provides an introduction and overview of LINQ (Language Integrated Query). It discusses what LINQ is, the language features that enable LINQ like lambda expressions, and how to write basic LINQ queries using both query syntax and method syntax. It also provides examples of using different LINQ providers, including LINQ to Objects for in-memory collections, and LINQ to SQL for querying SQL Server databases using entity classes generated by the Object Relational Designer tool.
Virtual functions allow functions in derived classes to override functions in base classes. When a base class pointer points to a derived class object, calling a virtual function through the pointer will call the derived class's version. This allows the same interface to behave differently based on the actual object. Virtual functions are useful for mathematical operations, where a base class defines an interface and derived classes perform specific calculations like addition, subtraction etc. depending on the object type pointed to by the base class pointer.
Vladymyr Bahrii Understanding polymorphism in C++ 16.11.17LogeekNightUkraine
The document discusses polymorphism in C++, including static polymorphism through function overloading and templates, and dynamic polymorphism using virtual functions and inheritance. It explains key concepts like the virtual method table that allows dynamic dispatch at runtime. The document provides examples of polymorphism techniques like the curiously recurring template pattern and proper use of virtual destructors. It warns against invoking virtual functions from constructors due to the class hierarchy not being fully established yet.
Rust is a systems programming language that offers performance comparable to C and C++ with memory safety and thread safety. It uses a borrow checker to enforce rules around ownership, borrowing, and lifetimes that prevent common bugs like use of dangling pointers and data races. Rust also supports features like generics, pattern matching, and idioms that improve productivity without sacrificing performance.
The document describes the "Cake Pattern" which is an alternative to dependency injection in Swift. It uses protocols, extensions and constraints to compose services in a modular way. Key aspects include defining services with protocols, implementing them with extensions, creating component protocols that wire services together, and applying constraints to determine behaviors based on types composed together. The Cake Pattern provides a standardized way to structure applications around loosely coupled, independently-developed components and services.
C# is similar to C++ but easier to use, as it does not support pointers, multiple inheritance, header files or global variables. Everything must live within a class or struct. The basic syntax will be familiar to C++ programmers. Key features include properties, interfaces, foreach loops, and delegates for event handling. Properties allow custom getter and setter logic and are preferred over public fields. Delegates provide a type-safe way to link methods, and events build on this to prevent issues with multicast delegates. Generics and assemblies are analogous to C++ templates and deployment units.
Le slide deck de l'Université que nous avons donnée avec Rémi Forax à Devoxx France 2019.
Comme promis, Java sort sa version majeure tous les 6 mois. Le train passe et amène son lot de nouveautés. Parmi elles, certaines sont sorties : une nouvelle syntaxe pour les clauses switch et l'instruction de byte code CONSTANT_DYNAMIC. D'autres sont en chantier, plus ou moins avancé : une nouvelle façon d'écrire des méthodes de façon condensée, un instanceof 'intelligent', des constantes évaluées au moment où elles sont utilisées. Les projets progressent. Loom, et son nouveau modèle de programmation concurrente que l'ont peut tester avec Jetty. Amber, qui introduit les data types et des nouvelles syntaxes. Valhalla, dont les value types donnent leurs premiers résultats. S'il est difficile de prévoir une date de sortie pour ces nouveautés, on sait en revanche qu'une fois prêtes elles sortiront en moins de 6 mois. De tout ceci nous parlerons donc au futur et en public, avec des démonstrations de code, des slides, du code, de la joie et de la bonne humeur !
This document compares key features of the C# and Java programming languages, including differences in their type systems, generics, keywords, exceptions handling, and specific features like anonymous classes, properties, delegates, and LINQ. It outlines common conventions and pitfalls between the two languages and provides code examples to illustrate differences in generics, constraints, exceptions, and language features like using blocks and lambda expressions.
The document provides an overview of C++ vs C# by Shubhra Chauhan. It discusses the key object-oriented programming concepts like classes, objects, inheritance, polymorphism, and how they are implemented in C++ and C#. It includes code examples to demonstrate class usage and inheritance in both languages. The document also compares some similarities and differences between C++ and C# like support for pointers, preprocessors, structures, and goto statements.
Virtual functions allow functions in derived classes to override functions in base classes. When a base class pointer points to a derived class object, calling a virtual function through the pointer will call the derived class's version. This allows the same interface to behave differently based on the actual object. Virtual functions are useful for mathematical operations, where a base class defines an interface and derived classes perform specific calculations like addition, subtraction etc. depending on the object type pointed to by the base class pointer.
Vladymyr Bahrii Understanding polymorphism in C++ 16.11.17LogeekNightUkraine
The document discusses polymorphism in C++, including static polymorphism through function overloading and templates, and dynamic polymorphism using virtual functions and inheritance. It explains key concepts like the virtual method table that allows dynamic dispatch at runtime. The document provides examples of polymorphism techniques like the curiously recurring template pattern and proper use of virtual destructors. It warns against invoking virtual functions from constructors due to the class hierarchy not being fully established yet.
Rust is a systems programming language that offers performance comparable to C and C++ with memory safety and thread safety. It uses a borrow checker to enforce rules around ownership, borrowing, and lifetimes that prevent common bugs like use of dangling pointers and data races. Rust also supports features like generics, pattern matching, and idioms that improve productivity without sacrificing performance.
The document describes the "Cake Pattern" which is an alternative to dependency injection in Swift. It uses protocols, extensions and constraints to compose services in a modular way. Key aspects include defining services with protocols, implementing them with extensions, creating component protocols that wire services together, and applying constraints to determine behaviors based on types composed together. The Cake Pattern provides a standardized way to structure applications around loosely coupled, independently-developed components and services.
C# is similar to C++ but easier to use, as it does not support pointers, multiple inheritance, header files or global variables. Everything must live within a class or struct. The basic syntax will be familiar to C++ programmers. Key features include properties, interfaces, foreach loops, and delegates for event handling. Properties allow custom getter and setter logic and are preferred over public fields. Delegates provide a type-safe way to link methods, and events build on this to prevent issues with multicast delegates. Generics and assemblies are analogous to C++ templates and deployment units.
Le slide deck de l'Université que nous avons donnée avec Rémi Forax à Devoxx France 2019.
Comme promis, Java sort sa version majeure tous les 6 mois. Le train passe et amène son lot de nouveautés. Parmi elles, certaines sont sorties : une nouvelle syntaxe pour les clauses switch et l'instruction de byte code CONSTANT_DYNAMIC. D'autres sont en chantier, plus ou moins avancé : une nouvelle façon d'écrire des méthodes de façon condensée, un instanceof 'intelligent', des constantes évaluées au moment où elles sont utilisées. Les projets progressent. Loom, et son nouveau modèle de programmation concurrente que l'ont peut tester avec Jetty. Amber, qui introduit les data types et des nouvelles syntaxes. Valhalla, dont les value types donnent leurs premiers résultats. S'il est difficile de prévoir une date de sortie pour ces nouveautés, on sait en revanche qu'une fois prêtes elles sortiront en moins de 6 mois. De tout ceci nous parlerons donc au futur et en public, avec des démonstrations de code, des slides, du code, de la joie et de la bonne humeur !
This document compares key features of the C# and Java programming languages, including differences in their type systems, generics, keywords, exceptions handling, and specific features like anonymous classes, properties, delegates, and LINQ. It outlines common conventions and pitfalls between the two languages and provides code examples to illustrate differences in generics, constraints, exceptions, and language features like using blocks and lambda expressions.
The document provides an overview of C++ vs C# by Shubhra Chauhan. It discusses the key object-oriented programming concepts like classes, objects, inheritance, polymorphism, and how they are implemented in C++ and C#. It includes code examples to demonstrate class usage and inheritance in both languages. The document also compares some similarities and differences between C++ and C# like support for pointers, preprocessors, structures, and goto statements.
Sometimes you see code that is perfectly OK according to the definition of the language, but which is flawed because it breaks too many established idioms and conventions. On the other hand, a solid piece of code is something that looks like it is written by an experienced person who cares about professionalism in programming.
A presentation at Norwegian Developer Conference 2010
C++ is an object-oriented programming language created by Bjarne Stroustrup in 1985 that maintains aspects of C while adding object-oriented features like classes. C++ can be used to create small programs or large applications across many domains. Key concepts covered include functions, classes, inheritance, polymorphism, and memory management techniques like realloc() and free().
The document provides information about differences between C# and C++ programming languages. It discusses key differences in areas such as pointers, references, classes and structs, accessing native code, destruction handling, operator overloading, preprocessor directives, and exceptions. It also covers C# features like delegates, events, attributes, properties, and configuration management using XML files. The document is intended to help C++ programmers transition to C# development.
This document compares the programming languages Java and C#. It discusses that C# was developed with the .NET framework in mind and is intended to be the primary language for .NET development. It outlines some subtle syntactic differences between the languages, like how print statements and inheritance are defined. It also examines some concepts that are modified in C# compared to Java, such as polymorphism and operator overloading. Finally, it presents some new concepts in C# that do not exist in Java, including enums, foreach loops, and properties.
The presentation shows major features of the new C++ standard (language and the library). The full list of new things is very broad, so I've categorized them to be easier to understand.
I use this slide deck in C# trainings to cover P/Invoke. Sample code can be found at https://github.com/rstropek/Samples/tree/master/PInvoke For details see my blog at http://www.software-architects.at
This document discusses various usability enhancements introduced in modern C++, including C++11/14/17. It covers topics such as auto type deduction, decltype, nullptr, range-based for loops, uniform initialization, lambda expressions, and more. The enhancements aim to improve code readability, reduce errors and increase developer productivity when programming in C++.
This document provides an overview of C++ and object-oriented programming concepts. It discusses:
1. C++ is an object-oriented programming language introduced in the 1980s that retains the power of C and adds classes, inheritance, function overloading, and operator overloading.
2. OOP languages like C++ are well-suited for developing large, complex programs like editors, compilers, databases, and communication systems due to features like modularity and code reusability.
3. A simple C++ program is presented that demonstrates basic syntax like main(), comments, cout and << operators, and return type for main(). Classes and member functions are also introduced.
The document is a tutorial on C++11 concurrency features such as asynchronous tasks, threads, promises, mutexes, and condition variables. It covers topics like spawning asynchronous tasks using std::async and std::thread, returning values from asynchronous tasks, passing parameters, handling exceptions, manually setting futures using std::promise and std::packaged_task, waiting for multiple futures, and using mutexes and lock guard templates for synchronization. Code examples are provided to illustrate the various concurrency features.
Slides from my "Gentle Introduction to Modern C++" presentation from January 20, 2015 at the Dublin C/C++ User Group: www.meetup.com/cppdug/events/219787667/
The code examples are located here: https://github.com/mihaitodor/Presentations/tree/master/cppdug/20.01.2015
This document provides an introduction to developing applications for Mac OS X using Cocoa and Objective-C. It covers key concepts like the Cocoa framework, Xcode development tools, Objective-C syntax for classes and methods, properties, strings and memory management. It also mentions that web developers can integrate HTML, CSS and JavaScript using WebKit and only need to use Objective-C when necessary functionality is not available in other languages.
OOP in C - Before GObject (Chinese Version)Kai-Feng Chou
This document discusses object-oriented programming concepts in C, including constructors. It explains how constructors work in C++, and how they can be simulated in C by using naming conventions and manually initializing parent and member values. The document concludes that for more complex inheritance hierarchies, it is better to use an object system like GObject that handles constructor execution order and initialization automatically.
The document introduces some basic C++ idioms, rules, guidelines and best practices. The author notes that some items are based on their personal style preferences and the styles of groups they work with. The intention is to use the presentation to spark discussion, as it includes some controversial issues. Readers are encouraged to provide criticism of the example code presented.
Polymorphism refers to an object's ability to take on multiple forms. In object-oriented programming, polymorphism occurs when an entity such as a variable, function, or object can have more than one form. There are two main types of polymorphism: compile-time polymorphism (such as function and operator overloading) and runtime polymorphism (using virtual functions). Polymorphism allows programmers to work with general classes and let the runtime system handle the specific types, providing flexibility.
This document provides an overview and introduction to PLY, a Python implementation of lex and yacc parsing tools. PLY allows writing parsers and compilers in Python by providing modules that handle lexical analysis (ply.lex) and parsing (ply.yacc) in a similar way to traditional lex and yacc tools. The document demonstrates how to define tokens and grammar rules with PLY and discusses why PLY is useful for building parsers and compilers in Python.
Presentation with a brief history of C, C++ and their ancestors along with an introduction to latest version C++11 and futures such as C++17. The presentation covers applications that use C++, C++11 compilers such as LLVM/Clang, some of the new language features in C++11 and C++17 and examples of modern idioms such as the new form compressions, initializer lists, lambdas, compile time type identification, improved memory management and improved standard library (threads, math, random, chrono, etc). (less == more) || (more == more)
An introductory PowerPoint to understanding and applying the C++ programming language. Broken down into lessons covering:
Introduction: Definitions and the History of Programming
Lesson 1: Libraries, Variables and Types, Blocks and Namespaces, Functions
Lesson 2: If...Else Statements, For and While Loops, Scope
Exercise: Program a Gumball Game
Lesson 3: Classes and Objects, Pointers
This document discusses various types of constructors in C++ including default, parameterized, copy constructors, and destructors. It also covers initialization lists, static class members, constant objects, and summarizes their key purposes and behaviors. Default constructors initialize objects without parameters, parameterized constructors allow passing initialization values, and copy constructors copy data from one object to another. Destructors clean up object resources. Initialization lists assign member values, static members have a single instance shared among objects, and constant objects cannot be modified.
MySQL and SQL Server are two leading database management systems. The key differences are that MySQL is open source and free while SQL Server requires payment for use. SQL Server offers more advanced features like indexed views, column-level security, triggers, stored procedures, and full join facilities that MySQL either lacks or had limited support for in earlier versions. SQL Server also provides more robust transaction management, replication, backup/recovery, and high availability capabilities compared to MySQL.
The document provides an overview of HTML5, including its new features compared to previous versions of HTML. It describes how HTML5 introduces new semantic elements, forms improvements, local storage capabilities, audio/video embedding without plugins, and drag-and-drop functionality. It also covers HTML5 document structure, elements, attributes, events, and forms improvements in Web Forms 2.0.
Sometimes you see code that is perfectly OK according to the definition of the language, but which is flawed because it breaks too many established idioms and conventions. On the other hand, a solid piece of code is something that looks like it is written by an experienced person who cares about professionalism in programming.
A presentation at Norwegian Developer Conference 2010
C++ is an object-oriented programming language created by Bjarne Stroustrup in 1985 that maintains aspects of C while adding object-oriented features like classes. C++ can be used to create small programs or large applications across many domains. Key concepts covered include functions, classes, inheritance, polymorphism, and memory management techniques like realloc() and free().
The document provides information about differences between C# and C++ programming languages. It discusses key differences in areas such as pointers, references, classes and structs, accessing native code, destruction handling, operator overloading, preprocessor directives, and exceptions. It also covers C# features like delegates, events, attributes, properties, and configuration management using XML files. The document is intended to help C++ programmers transition to C# development.
This document compares the programming languages Java and C#. It discusses that C# was developed with the .NET framework in mind and is intended to be the primary language for .NET development. It outlines some subtle syntactic differences between the languages, like how print statements and inheritance are defined. It also examines some concepts that are modified in C# compared to Java, such as polymorphism and operator overloading. Finally, it presents some new concepts in C# that do not exist in Java, including enums, foreach loops, and properties.
The presentation shows major features of the new C++ standard (language and the library). The full list of new things is very broad, so I've categorized them to be easier to understand.
I use this slide deck in C# trainings to cover P/Invoke. Sample code can be found at https://github.com/rstropek/Samples/tree/master/PInvoke For details see my blog at http://www.software-architects.at
This document discusses various usability enhancements introduced in modern C++, including C++11/14/17. It covers topics such as auto type deduction, decltype, nullptr, range-based for loops, uniform initialization, lambda expressions, and more. The enhancements aim to improve code readability, reduce errors and increase developer productivity when programming in C++.
This document provides an overview of C++ and object-oriented programming concepts. It discusses:
1. C++ is an object-oriented programming language introduced in the 1980s that retains the power of C and adds classes, inheritance, function overloading, and operator overloading.
2. OOP languages like C++ are well-suited for developing large, complex programs like editors, compilers, databases, and communication systems due to features like modularity and code reusability.
3. A simple C++ program is presented that demonstrates basic syntax like main(), comments, cout and << operators, and return type for main(). Classes and member functions are also introduced.
The document is a tutorial on C++11 concurrency features such as asynchronous tasks, threads, promises, mutexes, and condition variables. It covers topics like spawning asynchronous tasks using std::async and std::thread, returning values from asynchronous tasks, passing parameters, handling exceptions, manually setting futures using std::promise and std::packaged_task, waiting for multiple futures, and using mutexes and lock guard templates for synchronization. Code examples are provided to illustrate the various concurrency features.
Slides from my "Gentle Introduction to Modern C++" presentation from January 20, 2015 at the Dublin C/C++ User Group: www.meetup.com/cppdug/events/219787667/
The code examples are located here: https://github.com/mihaitodor/Presentations/tree/master/cppdug/20.01.2015
This document provides an introduction to developing applications for Mac OS X using Cocoa and Objective-C. It covers key concepts like the Cocoa framework, Xcode development tools, Objective-C syntax for classes and methods, properties, strings and memory management. It also mentions that web developers can integrate HTML, CSS and JavaScript using WebKit and only need to use Objective-C when necessary functionality is not available in other languages.
OOP in C - Before GObject (Chinese Version)Kai-Feng Chou
This document discusses object-oriented programming concepts in C, including constructors. It explains how constructors work in C++, and how they can be simulated in C by using naming conventions and manually initializing parent and member values. The document concludes that for more complex inheritance hierarchies, it is better to use an object system like GObject that handles constructor execution order and initialization automatically.
The document introduces some basic C++ idioms, rules, guidelines and best practices. The author notes that some items are based on their personal style preferences and the styles of groups they work with. The intention is to use the presentation to spark discussion, as it includes some controversial issues. Readers are encouraged to provide criticism of the example code presented.
Polymorphism refers to an object's ability to take on multiple forms. In object-oriented programming, polymorphism occurs when an entity such as a variable, function, or object can have more than one form. There are two main types of polymorphism: compile-time polymorphism (such as function and operator overloading) and runtime polymorphism (using virtual functions). Polymorphism allows programmers to work with general classes and let the runtime system handle the specific types, providing flexibility.
This document provides an overview and introduction to PLY, a Python implementation of lex and yacc parsing tools. PLY allows writing parsers and compilers in Python by providing modules that handle lexical analysis (ply.lex) and parsing (ply.yacc) in a similar way to traditional lex and yacc tools. The document demonstrates how to define tokens and grammar rules with PLY and discusses why PLY is useful for building parsers and compilers in Python.
Presentation with a brief history of C, C++ and their ancestors along with an introduction to latest version C++11 and futures such as C++17. The presentation covers applications that use C++, C++11 compilers such as LLVM/Clang, some of the new language features in C++11 and C++17 and examples of modern idioms such as the new form compressions, initializer lists, lambdas, compile time type identification, improved memory management and improved standard library (threads, math, random, chrono, etc). (less == more) || (more == more)
An introductory PowerPoint to understanding and applying the C++ programming language. Broken down into lessons covering:
Introduction: Definitions and the History of Programming
Lesson 1: Libraries, Variables and Types, Blocks and Namespaces, Functions
Lesson 2: If...Else Statements, For and While Loops, Scope
Exercise: Program a Gumball Game
Lesson 3: Classes and Objects, Pointers
This document discusses various types of constructors in C++ including default, parameterized, copy constructors, and destructors. It also covers initialization lists, static class members, constant objects, and summarizes their key purposes and behaviors. Default constructors initialize objects without parameters, parameterized constructors allow passing initialization values, and copy constructors copy data from one object to another. Destructors clean up object resources. Initialization lists assign member values, static members have a single instance shared among objects, and constant objects cannot be modified.
MySQL and SQL Server are two leading database management systems. The key differences are that MySQL is open source and free while SQL Server requires payment for use. SQL Server offers more advanced features like indexed views, column-level security, triggers, stored procedures, and full join facilities that MySQL either lacks or had limited support for in earlier versions. SQL Server also provides more robust transaction management, replication, backup/recovery, and high availability capabilities compared to MySQL.
The document provides an overview of HTML5, including its new features compared to previous versions of HTML. It describes how HTML5 introduces new semantic elements, forms improvements, local storage capabilities, audio/video embedding without plugins, and drag-and-drop functionality. It also covers HTML5 document structure, elements, attributes, events, and forms improvements in Web Forms 2.0.
The document provides background information on the history and geography of the United Arab Emirates (UAE). It discusses how the UAE was formed from seven emirates and gained independence in 1971. It also summarizes the UAE's oil resources, economy, demographics, and culture. Key points include that the UAE has significant oil and natural gas reserves, a very high human development index, and Islam is the main religion while Arabic is the official language.
Pinterest is a social media platform where users can create boards to "pin" and organize images and videos they find interesting or inspiring online. It was launched in 2010 by Ben Silbermann and allows users to categorize pins across different topics like fashion, food, home decor and more. While publishers initially declined to meet with Silbermann about purchasing Pinterest early on, it has since grown tremendously to over 27 million users and is now valued at $1.5 billion, receiving numerous buyout offers that Silbermann has rejected.
LINQ adds features to C# that allow static SQL-like expressions to be used for querying data collections. Key features added include lambda expressions, extension methods, expression trees, list comprehension, anonymous types, and type inference. These features allow C# code to represent SQL queries as code that can then be translated to underlying data sources like databases. Expression trees in particular allow the lambda expressions to be represented as syntax trees that can be converted to executable queries like SQL at runtime. Many of the features added to C# with LINQ came from functional programming languages.
This document provides an overview of basic VBScript concepts used in QuickTest Professional (QTP). It discusses VBScript variables, arrays, functions, conditional and looping statements, date/time functions, built-in functions, and classes. VBScript is the scripting language used in QTP and is a lightweight version of Visual Basic. VBScript code is contained in .vbs files and variables can be explicitly or implicitly declared. Arrays allow storing multiple values in indexed elements. Functions and subroutines can perform actions and return values. Conditional statements like If/Then execute code based on conditions, while looping statements like For/Next repeat code. Built-in functions perform tasks like formatting dates and strings. Classes define custom data
This document discusses LINQ to SharePoint and sandboxed solutions. It begins with an introduction to the presenter and agenda. It then covers some of the limitations of using CAML queries and SQL queries directly in SharePoint. It introduces LINQ as a simpler way to query data and discusses how LINQ to SQL works. It also demonstrates some C# language features like lambda expressions, query syntax, and anonymous types that enable LINQ. Finally, it concludes with a promise to demonstrate LINQ queries in a later portion of the session.
The document provides an overview of using VBScript in QuickTest Professional (QTP) for automation testing. It covers VBScript variables, arrays, functions, subroutines, and conditional statements. The document contains code examples for each concept and provides a tutorial on the basics of the VBScript language used for test automation in QTP. It directs readers to a blog for additional QTP tutorials and interview questions.
Visual Studio 2008 provides support for multi-targeting applications, occasionally connected systems, Office applications, client applications, Windows Communication Foundation, ASP.NET web applications, and C# 3.0 and LINQ. It also includes ADO.NET Sync Services, support for WPF, WCF, and LINQ in applications. New features in Visual Studio 2008 improve developer productivity and the development of Windows, web, database, and .NET applications.
Java 8 is coming soon. In this presentation I have outlined the major Java 8 features. You get information about interface improvements, functional interfaces, method references, lambdas, java.util.function, java.util.stream
LINQ (Language Integrated Query) is Microsoft's technology that allows querying of data from various sources using a common language syntax. It provides a uniform programming model to query and manipulate data regardless of data source. LINQ queries can be executed against in-memory collections, databases, XML documents, and other data sources. The document discusses various LINQ concepts such as LINQ query expressions, deferred execution, implicit typing with var, extension methods of the Enumerable class, and LINQ to Objects for querying arrays and generic/non-generic collections.
Swift 5.1 brought a new construct to the language: Property Wrappers. SwiftUI, for instance, relies heavily on it to provide its system of data-binding through annotations like @State, @EnvironmentObjects, etc.
Unlike other language improvements, Codable for instance, Apple hasn’t restricted the use of this new feature to its own frameworks: any codebase is free to leverage it to implement custom property attributes that will suit its own specific needs.
While this is a great opportunity to factorise common behaviours throughout a project, one can still wonder: won’t it hurt code readability and predictability on the long run? Keeping code short is good, but if it’s achieved through a collection of arcane annotations, it might end up defying the original intent.
In this talk, I want to introduce what Property Wrappers are, give some example of how they can be leveraged, and try to provide some guidelines on when we they should or shouldn’t be use.
Top 10 bugs in C++ open source projects, checked in 2016PVS-Studio
While the world is discussing the 89th Ceremony of Oscar award and charts of actors and costumes, we've decided to write a review article about the IT-sphere. The article is going to cover the most interesting bugs, made in open source projects in 2016. This year was remarkable for our tool, as PVS-Studio has become available on Linux OS. The errors we present are hopefully, already fixed, but every reader can see how serious are the errors made by developers.
Peter Lawrey is the CEO of Chronicle Software. He has 7 years experience working as a Java developer for investment banks and trading firms. Chronicle Software helps companies migrate to high performance Java code and was involved in one of the first large Java 8 projects in production in December 2014. The company offers workshops, training, consulting and custom development services. The talk will cover reading and writing lambdas, capturing vs non-capturing lambdas, transforming imperative code to streams, mixing imperative and functional code, and taking Q&A.
This document summarizes new syntactic features introduced in recent versions of C#, including C# 6.0, 7.0, and 7.1. It provides examples of properties with auto-properties and initializers, lambda expressions used in properties and methods, inline variables, null expressions with null-coalescing and null-conditional operators, throw expressions, local functions, value tuples, and pattern matching. It also briefly mentions features planned for future versions like C# 7.2, 8, and beyond such as read-only references, nullable reference types, and default interface methods.
The document provides an overview of Microsoft Visual C# and C# basics. It covers topics like getting started with a first C# program, data types, operators, control statements, namespaces, objects and types, methods, classes, structs, inheritance, interfaces, polymorphism, arrays, generics, collections, memory management, attributes, exceptions and more. It also discusses C# compiler options, console I/O formatting, comments, and directives.
Adapting clean architecture in android appsMatso Abgaryan
Are you looking for a better architecture that fits your complex Android apps? Have you heard about Clean Architecture but don’t know if it will fit your Android app?
In my talk, you will learn how to Adapting clean architecture in Android apps including:
What is Clean Architecture?
Layers of a Clean Architecture?
What are SOLID design principles?
What are RRP, CCP, and CRP component principles?
The tension Diagram for component principles?
Clean Architecture layers in Android
How to organize modules in Android?
Data flow between layers in Android?
Describe the C#.Net major features. This slide includes C# 5.0, C# 6.0 and C# 7.0. C#.net evolution part 1, that is published previously included the C# 1.0, C# 2.0, C# 3.0 and C# 4.0.
The document discusses various small features and techniques in .NET called "little wonders" that can improve code readability, maintainability, and performance. It provides examples of implicit typing, auto-properties, using blocks, static class modifiers, casts, string methods, object and path helpers, Stopwatch, TimeSpan factories, operators, initializers, and extension methods. The techniques allow writing more concise and clear code to handle common tasks like property declaration, exception handling, null checking, and LINQ queries.
This document provides an overview and introduction to Language Integrated Query (LINQ) in 3 sentences or less:
LINQ allows for a common syntax to query different types of data by enabling queries across objects, XML, SQL databases and other data sources using lambda expressions, extension methods, and other new C# 3.0 features. The document outlines the LINQ architecture and demonstrates LINQ to Objects, LINQ to SQL, and LINQ to XML, showing how LINQ provides a consistent query experience across .NET data sources. Key LINQ capabilities include IntelliSense support, deferred query execution, and strong typing checked by the compiler.
This document provides an introduction to LINQ (Language Integrated Query). LINQ allows querying over various data sources using a common SQL-like syntax. It introduces key LINQ concepts like LINQ to Objects, LINQ to SQL, LINQ to XML and language features in .NET that support LINQ like lambda expressions and extension methods. The document also provides examples of standard query operators and using LINQ to query objects, databases and XML documents.
This document provides an explanation of VBScript for use in HP QuickTest Professional (QTP). It covers key VBScript concepts like data types, variables, arrays, constants, functions, subroutines, and arguments. It includes examples to demonstrate each concept. The document is organized into 12 sections covering these topics at a high level.
Dr archana dhawan bajaj's Sales JetView.Dr archana dhawan bajaj is a renowned practising doctor of non-commercial of India and Dr archana various Hospitals and Meternity.Dr archana dhawan bajaj has a PH.d master's degree in both human & International client Management along with other fellow.Dr archana is known to be proficient in Hindi,English,Sanskrit and Urdu.Dr archana dhawan bajaj has acquired extensive practice experience in maternity primarily in relation to corporate and international matter delivery.Dr archana dhawan bajaj's Sales JetView.Dr archana dhawan bajaj is a renowned practising doctor of non-commercial of India and Dr archana various Hospitals and Meternity.Dr archana dhawan bajaj has a PH.d master's degree in both human & International client Management along with other fellow.Dr archana is known to be proficient in Hindi,English,Sanskrit and Urdu.Dr archana dhawan bajaj has acquired extensive practice experience in maternity primarily in relation to corporate and international matter delivery.Dr archana dhawan bajaj's Sales JetView.Dr archana dhawan bajaj is a renowned practising doctor of non-commercial of India and Dr archana various Hospitals and Meternity.Dr archana dhawan bajaj has a PH.d master's degree in both human & International client Management along with other fellow.Dr archana is known to be proficient in Hindi,English,Sanskrit and Urdu.Dr archana dhawan bajaj has acquired extensive practice experience in maternity primarily in relation to corporate and international matter delivery.Dr archana dhawan bajaj's Sales JetView.Dr archana dhawan bajaj is a renowned practising doctor of non-commercial of India and Dr archana various Hospitals and Meternity.Dr archana dhawan bajaj has a PH.d master's degree in both human & International client Management along with other fellow.Dr archana is known to be proficient in Hindi,English,Sanskrit and Urdu.Dr archana dhawan bajaj has acquired extensive practice experience in maternity primarily in relation to corporate and international matter delivery.Dr archana dhawan bajaj's Sales JetView.Dr archana dhawan bajaj is a renowned practising doctor of non-commercial of India and Dr archana various Hospitals and Meternity.Dr archana dhawan bajaj has a PH.d master's degree in both human & International client Management along with other fellow.Dr archana is known to be proficient in Hindi,English,Sanskrit and Urdu.Dr archana dhawan bajaj has acquired extensive practice experience in maternity primarily in relation to corporate and international matter delivery.Dr archana dhawan bajaj's Sales JetView.Dr archana dhawan bajaj is a renowned practising doctor of non-commercial of India and Dr archana various Hospitals and Meternity.Dr archana dhawan bajaj has a PH.d master's degree in both human & International client Management along with other fellow.Dr archana is known to be proficient in Hindi,English,Sanskrit and Urdu.Dr archana dhawan bajaj has acquired extensive practice exp
The document summarizes the new features introduced in C# 8.0, including nullable reference types, implicitly typed expressions, ranges and indices, default interface implementations, recursive patterns, switch expressions, and asynchronous streams. It provides examples of using each new feature and notes how developers can learn more about C# 8.0.
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Speck&Tech
ABSTRACT: A prima vista, un mattoncino Lego e la backdoor XZ potrebbero avere in comune il fatto di essere entrambi blocchi di costruzione, o dipendenze di progetti creativi e software. La realtà è che un mattoncino Lego e il caso della backdoor XZ hanno molto di più di tutto ciò in comune.
Partecipate alla presentazione per immergervi in una storia di interoperabilità, standard e formati aperti, per poi discutere del ruolo importante che i contributori hanno in una comunità open source sostenibile.
BIO: Sostenitrice del software libero e dei formati standard e aperti. È stata un membro attivo dei progetti Fedora e openSUSE e ha co-fondato l'Associazione LibreItalia dove è stata coinvolta in diversi eventi, migrazioni e formazione relativi a LibreOffice. In precedenza ha lavorato a migrazioni e corsi di formazione su LibreOffice per diverse amministrazioni pubbliche e privati. Da gennaio 2020 lavora in SUSE come Software Release Engineer per Uyuni e SUSE Manager e quando non segue la sua passione per i computer e per Geeko coltiva la sua curiosità per l'astronomia (da cui deriva il suo nickname deneb_alpha).
Monitoring and Managing Anomaly Detection on OpenShift.pdfTosin Akinosho
Monitoring and Managing Anomaly Detection on OpenShift
Overview
Dive into the world of anomaly detection on edge devices with our comprehensive hands-on tutorial. This SlideShare presentation will guide you through the entire process, from data collection and model training to edge deployment and real-time monitoring. Perfect for those looking to implement robust anomaly detection systems on resource-constrained IoT/edge devices.
Key Topics Covered
1. Introduction to Anomaly Detection
- Understand the fundamentals of anomaly detection and its importance in identifying unusual behavior or failures in systems.
2. Understanding Edge (IoT)
- Learn about edge computing and IoT, and how they enable real-time data processing and decision-making at the source.
3. What is ArgoCD?
- Discover ArgoCD, a declarative, GitOps continuous delivery tool for Kubernetes, and its role in deploying applications on edge devices.
4. Deployment Using ArgoCD for Edge Devices
- Step-by-step guide on deploying anomaly detection models on edge devices using ArgoCD.
5. Introduction to Apache Kafka and S3
- Explore Apache Kafka for real-time data streaming and Amazon S3 for scalable storage solutions.
6. Viewing Kafka Messages in the Data Lake
- Learn how to view and analyze Kafka messages stored in a data lake for better insights.
7. What is Prometheus?
- Get to know Prometheus, an open-source monitoring and alerting toolkit, and its application in monitoring edge devices.
8. Monitoring Application Metrics with Prometheus
- Detailed instructions on setting up Prometheus to monitor the performance and health of your anomaly detection system.
9. What is Camel K?
- Introduction to Camel K, a lightweight integration framework built on Apache Camel, designed for Kubernetes.
10. Configuring Camel K Integrations for Data Pipelines
- Learn how to configure Camel K for seamless data pipeline integrations in your anomaly detection workflow.
11. What is a Jupyter Notebook?
- Overview of Jupyter Notebooks, an open-source web application for creating and sharing documents with live code, equations, visualizations, and narrative text.
12. Jupyter Notebooks with Code Examples
- Hands-on examples and code snippets in Jupyter Notebooks to help you implement and test anomaly detection models.
Infrastructure Challenges in Scaling RAG with Custom AI modelsZilliz
Building Retrieval-Augmented Generation (RAG) systems with open-source and custom AI models is a complex task. This talk explores the challenges in productionizing RAG systems, including retrieval performance, response synthesis, and evaluation. We’ll discuss how to leverage open-source models like text embeddings, language models, and custom fine-tuned models to enhance RAG performance. Additionally, we’ll cover how BentoML can help orchestrate and scale these AI components efficiently, ensuring seamless deployment and management of RAG systems in the cloud.
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceIndexBug
Imagine a world where machines not only perform tasks but also learn, adapt, and make decisions. This is the promise of Artificial Intelligence (AI), a technology that's not just enhancing our lives but revolutionizing entire industries.
Things to Consider When Choosing a Website Developer for your Website | FODUUFODUU
Choosing the right website developer is crucial for your business. This article covers essential factors to consider, including experience, portfolio, technical skills, communication, pricing, reputation & reviews, cost and budget considerations and post-launch support. Make an informed decision to ensure your website meets your business goals.
Removing Uninteresting Bytes in Software FuzzingAftab Hussain
Imagine a world where software fuzzing, the process of mutating bytes in test seeds to uncover hidden and erroneous program behaviors, becomes faster and more effective. A lot depends on the initial seeds, which can significantly dictate the trajectory of a fuzzing campaign, particularly in terms of how long it takes to uncover interesting behaviour in your code. We introduce DIAR, a technique designed to speedup fuzzing campaigns by pinpointing and eliminating those uninteresting bytes in the seeds. Picture this: instead of wasting valuable resources on meaningless mutations in large, bloated seeds, DIAR removes the unnecessary bytes, streamlining the entire process.
In this work, we equipped AFL, a popular fuzzer, with DIAR and examined two critical Linux libraries -- Libxml's xmllint, a tool for parsing xml documents, and Binutil's readelf, an essential debugging and security analysis command-line tool used to display detailed information about ELF (Executable and Linkable Format). Our preliminary results show that AFL+DIAR does not only discover new paths more quickly but also achieves higher coverage overall. This work thus showcases how starting with lean and optimized seeds can lead to faster, more comprehensive fuzzing campaigns -- and DIAR helps you find such seeds.
- These are slides of the talk given at IEEE International Conference on Software Testing Verification and Validation Workshop, ICSTW 2022.
CAKE: Sharing Slices of Confidential Data on BlockchainClaudio Di Ciccio
Presented at the CAiSE 2024 Forum, Intelligent Information Systems, June 6th, Limassol, Cyprus.
Synopsis: Cooperative information systems typically involve various entities in a collaborative process within a distributed environment. Blockchain technology offers a mechanism for automating such processes, even when only partial trust exists among participants. The data stored on the blockchain is replicated across all nodes in the network, ensuring accessibility to all participants. While this aspect facilitates traceability, integrity, and persistence, it poses challenges for adopting public blockchains in enterprise settings due to confidentiality issues. In this paper, we present a software tool named Control Access via Key Encryption (CAKE), designed to ensure data confidentiality in scenarios involving public blockchains. After outlining its core components and functionalities, we showcase the application of CAKE in the context of a real-world cyber-security project within the logistics domain.
Paper: https://doi.org/10.1007/978-3-031-61000-4_16
HCL Notes and Domino License Cost Reduction in the World of DLAUpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-notes-and-domino-license-cost-reduction-in-the-world-of-dlau/
The introduction of DLAU and the CCB & CCX licensing model caused quite a stir in the HCL community. As a Notes and Domino customer, you may have faced challenges with unexpected user counts and license costs. You probably have questions on how this new licensing approach works and how to benefit from it. Most importantly, you likely have budget constraints and want to save money where possible. Don’t worry, we can help with all of this!
We’ll show you how to fix common misconfigurations that cause higher-than-expected user counts, and how to identify accounts which you can deactivate to save money. There are also frequent patterns that can cause unnecessary cost, like using a person document instead of a mail-in for shared mailboxes. We’ll provide examples and solutions for those as well. And naturally we’ll explain the new licensing model.
Join HCL Ambassador Marc Thomas in this webinar with a special guest appearance from Franz Walder. It will give you the tools and know-how to stay on top of what is going on with Domino licensing. You will be able lower your cost through an optimized configuration and keep it low going forward.
These topics will be covered
- Reducing license cost by finding and fixing misconfigurations and superfluous accounts
- How do CCB and CCX licenses really work?
- Understanding the DLAU tool and how to best utilize it
- Tips for common problem areas, like team mailboxes, functional/test users, etc
- Practical examples and best practices to implement right away
Climate Impact of Software Testing at Nordic Testing DaysKari Kakkonen
My slides at Nordic Testing Days 6.6.2024
Climate impact / sustainability of software testing discussed on the talk. ICT and testing must carry their part of global responsibility to help with the climat warming. We can minimize the carbon footprint but we can also have a carbon handprint, a positive impact on the climate. Quality characteristics can be added with sustainability, and then measured continuously. Test environments can be used less, and in smaller scale and on demand. Test techniques can be used in optimizing or minimizing number of tests. Test automation can be used to speed up testing.
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slackshyamraj55
Discover the seamless integration of RPA (Robotic Process Automation), COMPOSER, and APM with AWS IDP enhanced with Slack notifications. Explore how these technologies converge to streamline workflows, optimize performance, and ensure secure access, all while leveraging the power of AWS IDP and real-time communication via Slack notifications.
Ivanti’s Patch Tuesday breakdown goes beyond patching your applications and brings you the intelligence and guidance needed to prioritize where to focus your attention first. Catch early analysis on our Ivanti blog, then join industry expert Chris Goettl for the Patch Tuesday Webinar Event. There we’ll do a deep dive into each of the bulletins and give guidance on the risks associated with the newly-identified vulnerabilities.
How to Get CNIC Information System with Paksim Ga.pptxdanishmna97
Pakdata Cf is a groundbreaking system designed to streamline and facilitate access to CNIC information. This innovative platform leverages advanced technology to provide users with efficient and secure access to their CNIC details.
Unlocking Productivity: Leveraging the Potential of Copilot in Microsoft 365, a presentation by Christoforos Vlachos, Senior Solutions Manager – Modern Workplace, Uni Systems
Best 20 SEO Techniques To Improve Website Visibility In SERPPixlogix Infotech
Boost your website's visibility with proven SEO techniques! Our latest blog dives into essential strategies to enhance your online presence, increase traffic, and rank higher on search engines. From keyword optimization to quality content creation, learn how to make your site stand out in the crowded digital landscape. Discover actionable tips and expert insights to elevate your SEO game.
Driving Business Innovation: Latest Generative AI Advancements & Success StorySafe Software
Are you ready to revolutionize how you handle data? Join us for a webinar where we’ll bring you up to speed with the latest advancements in Generative AI technology and discover how leveraging FME with tools from giants like Google Gemini, Amazon, and Microsoft OpenAI can supercharge your workflow efficiency.
During the hour, we’ll take you through:
Guest Speaker Segment with Hannah Barrington: Dive into the world of dynamic real estate marketing with Hannah, the Marketing Manager at Workspace Group. Hear firsthand how their team generates engaging descriptions for thousands of office units by integrating diverse data sources—from PDF floorplans to web pages—using FME transformers, like OpenAIVisionConnector and AnthropicVisionConnector. This use case will show you how GenAI can streamline content creation for marketing across the board.
Ollama Use Case: Learn how Scenario Specialist Dmitri Bagh has utilized Ollama within FME to input data, create custom models, and enhance security protocols. This segment will include demos to illustrate the full capabilities of FME in AI-driven processes.
Custom AI Models: Discover how to leverage FME to build personalized AI models using your data. Whether it’s populating a model with local data for added security or integrating public AI tools, find out how FME facilitates a versatile and secure approach to AI.
We’ll wrap up with a live Q&A session where you can engage with our experts on your specific use cases, and learn more about optimizing your data workflows with AI.
This webinar is ideal for professionals seeking to harness the power of AI within their data management systems while ensuring high levels of customization and security. Whether you're a novice or an expert, gain actionable insights and strategies to elevate your data processes. Join us to see how FME and AI can revolutionize how you work with data!
In the rapidly evolving landscape of technologies, XML continues to play a vital role in structuring, storing, and transporting data across diverse systems. The recent advancements in artificial intelligence (AI) present new methodologies for enhancing XML development workflows, introducing efficiency, automation, and intelligent capabilities. This presentation will outline the scope and perspective of utilizing AI in XML development. The potential benefits and the possible pitfalls will be highlighted, providing a balanced view of the subject.
We will explore the capabilities of AI in understanding XML markup languages and autonomously creating structured XML content. Additionally, we will examine the capacity of AI to enrich plain text with appropriate XML markup. Practical examples and methodological guidelines will be provided to elucidate how AI can be effectively prompted to interpret and generate accurate XML markup.
Further emphasis will be placed on the role of AI in developing XSLT, or schemas such as XSD and Schematron. We will address the techniques and strategies adopted to create prompts for generating code, explaining code, or refactoring the code, and the results achieved.
The discussion will extend to how AI can be used to transform XML content. In particular, the focus will be on the use of AI XPath extension functions in XSLT, Schematron, Schematron Quick Fixes, or for XML content refactoring.
The presentation aims to deliver a comprehensive overview of AI usage in XML development, providing attendees with the necessary knowledge to make informed decisions. Whether you’re at the early stages of adopting AI or considering integrating it in advanced XML development, this presentation will cover all levels of expertise.
By highlighting the potential advantages and challenges of integrating AI with XML development tools and languages, the presentation seeks to inspire thoughtful conversation around the future of XML development. We’ll not only delve into the technical aspects of AI-powered XML development but also discuss practical implications and possible future directions.
3. Paul Litwin
Developer
Focus: ASP.NET, ASP, VB, C#, SQL Server, …
MCSD
Microsoft MVP
Programming Manger with
Fred Hutchinson Cancer Research Center (Seattle)
Co-Founder and Senior Trainer
Deep Training
www.deeptraining.com
Conference Chair/Speaker
Chair, Microsoft ASP.NET Connections
Member INETA Speakers Bureau
Author
Author/co-author of a dozen books, including…
ASP.NET for Developers
Access Cookbook, 2nd edition
Access 2002 Desktop/Enterprise Dev Handbook
AppDev SQL Server 2005 Reporting Services Course
3
4. This Talk Brought to You By…
INETA
International .NET Users Association
Speaker Bureau
4
5. What is LINQ?
LINQ == Language Integrated Query
Additions to .NET languages that enable
language-based querying
LINQ Providers
LINQ to Objects – in memory-collections
LINQ to SQL – SQL Server databases
LINQ to XML – XML documents
LINQ to DataSets – data in a ADO.NET DataSet
LINQ to Entities – works with ADO.NET Entity
Framework
…
5
6. Language Features Behind LINQ
Automatic Properties
Object and Collection Initializers
Inferred and Anonymous Types
Extension Methods
Lambda Expressions
6
7. Automatic Properties – C# Only
Quick way to define property Not really
necessary for LINQ but nice
replace this
with this
private string _firstName;
private string _firstName;
public string firstName { get; set; }
public string firstName { get; set; }
public string firstName
public string firstName
{
{
get { return _firstName; }
get { return _firstName; }
set { _firstName = value; }
set { _firstName = value; }
}
}
7
8. Object Initializers – C#
Quick way to create an instance and set a
bunch of properties
replace this
Cust20 cust20 = new Cust20();
Cust20 cust20 = new Cust20();
cust20.firstName = "Groucho";
cust20.firstName = "Groucho";
cust20.lastName = "Marx";
cust20.lastName = "Marx";
cust20.birthDate = new DateTime(1890, 10, 2);
cust20.birthDate = new DateTime(1890, 10, 2);
with this
Cust35 cust35 = new Cust35 { firstName = "Jim",
Cust35 cust35 = new Cust35 { firstName = "Jim",
lastName = "Gaffigan", birthDate = new DateTime(1966, 7, 7) };
lastName = "Gaffigan", birthDate = new DateTime(1966, 7, 7) };
8
9. Object Initializers – VB
Quick way to create an instance and set a
bunch of properties
replace this
Dim cust20 As New Cust20()
Dim cust20 As New Cust20()
cust20.firstName = "Groucho"
cust20.firstName = "Groucho"
cust20.lastName = "Marx"
cust20.lastName = "Marx"
cust20.birthDate = New DateTime(1890, 10, 2)
cust20.birthDate = New DateTime(1890, 10, 2)
with this
Dim cust20 As New Cust20() With {.firstName = "Jim", _
Dim cust20 As New Cust20() With {.firstName = "Jim", _
.lastName = "Gaffigan", .birthDate = New DateTime(1966, 7, 7)}
.lastName = "Gaffigan", .birthDate = New DateTime(1966, 7, 7)}
9
10. Collection Initializers – C# Only
replace this
List<Cust20> pcTitans20 = new List<Cust20>();
List<Cust20> pcTitans20 = new List<Cust20>();
Cust20 steveJobs = new Cust20();
Cust20 steveJobs = new Cust20();
steveJobs.firstName = "Steve";
steveJobs.firstName = "Steve";
steveJobs.lastName = "Jobs";
steveJobs.lastName = "Jobs";
steveJobs.birthDate = new DateTime(1955, 2, 24);
steveJobs.birthDate = new DateTime(1955, 2, 24);
pcTitans20.Add(steveJobs);
pcTitans20.Add(steveJobs);
…
…
with this
List<Cust20> pcTitans35 = new List<Cust35>
List<Cust20> pcTitans35 = new List<Cust35>
{
{
new Cust35{firstName="Steve",lastName="Jobs",
new Cust35{firstName="Steve",lastName="Jobs",
birthDate=new DateTime(1955,2,24)},
birthDate=new DateTime(1955,2,24)},
…
…
}
}
10
11. Type Inference
Have compiler infer type from usage
C#
var serialNumber1 = 123456;
var serialNumber2 = "789";
// inferred as int
// inferred as string
VB
Dim serialNumber1 = 123456
Dim serialNumber2 = "789"
' inferred as int
' inferred as string
11
12. Anonymous Types
Allow you create an instance of an unnamed (i.e., anonymous) class that is
defined in line
C#
var myHouse = new {color = "green", address = "100 Elm"}
VB
Dim myHouse = New With {.color = "green", _
.address = "100 Elm"}
12
13. Extension Methods – C#
Allow you to add a custom method to an
existing type
public static class ScottGuExtensions
{
public static bool IsValidEmailAddress (this string s)
{
Regex regex = new
Regex(@"^[w-.]+@([w-]+.)+[w-]{2,4}$");
return regex.IsMatch(s);
}
}
13
14. Extension Methods – VB
Allow you to add a custom method to an
existing type
Imports System.Runtime.CompilerServices
Imports System.Text.RegularExpressions
Public Module ScottGuExtensions
Public
ScottGuExtensions
<Extension()> _
Public Function IsValidEmailAddess(ByVal s As String) _
As Boolean
Dim regex As Regex = _
As
New Regex("^[w-.]+@([w-]+.)+[w-]{2,4}$")
Return regex.IsMatch(s)
End Function
End Module
14
15. Basic LINQ Examples
Comedians = new List<String> { "Groucho Marx", "Eric Idle", … }
var results = from c in Comedians
where c.Contains("Marx")
select c;
var results = from c in Comedians
orderby c
select c;
LINQ2Objects.aspx – C#
LINQ2ObjectsVB.aspx – VB
15
16. Query Basics – C#
Query expression consists of set of clauses written
in a declarative syntax similar to SQL or XQuery
Query must
begin with from clause, and
end with select or group clause
Between 1st from clause and last select/group
clause, it can contain one or more of following
clauses
where
orderby
join
let
from
into
16
17. Query Basics – VB
Query expression consists of set of clauses written
in a declarative syntax similar to SQL or XQuery
Query must
begin with From or Aggregate clause
After From/Aggregate clause, you may include any
of following clauses
Select
Where
Order By
Join
Group By
Aggregate
Let
Distinct
Take
Take While
Skip
Skip While
Into
17
18. Contrasting Query Keywords
C# LINQ
VB LINQ
ANSI SQL
from
From
FROM
select
Select
SELECT
where
Where
WHERE
orderby
Order By
ORDER BY
join
Join
JOIN
group
Group By
GROUP BY
Distinct()
Distinct
DISTINCT
into
Into
INTO
let
Let
AS
Count(), Sum(),…
Aggregate
COUNT, SUM,… w/ no group
Skip()
SkipWhile()
Skip
Skip While
n/a
Take()
TakeWhile()
Take
Take While
n/a
18
19. LINQ Basics
There are two ways to write LINQ queries
Query syntax
The previous examples used this syntax
Method syntax
This syntax uses Lambda expressions
19
22. Lambda Expressions
=> goes into
separates parameters from method body
can drop parentheses when there is only
one parameter
22
23. LINQ – C#
Equivalent LINQ queries
query syntax
var results = from c in Comedians
where c.Contains("Marx")
select c;
method (lambda expression) syntax
var results = Comedians.Where(c => c.Contains("Marx"));
23
24. LINQ – VB
Equivalent LINQ queries
query syntax
Dim results = From c In Comedians _
Where (c.Contains("Marx")) _
Select c
method (lambda expression) syntax
Dim results = Comedians.Where(Function(c) c.Contains("Marx"))
24
25. LINQ – Hybrid Syntax
You can also use a hybrid of query and
method syntax
often this is necessary because using query
syntax alone is not expressive enough,
especially when using C#
var results = (from c in Comedians
select c).Count();
25
26. LINQ to Objects
If an object supports either IEnumerable
or IEnumerable<T> interface, LINQ to
Objects provider enables you to query it
Array, ArrayList, collections, generic
collections, …
System.Linq namespace
All examples shown so far have used
LINQ to Objects
26
27. LINQ to SQL
System.Data.Linq namespace
Works with SQL Server 2000/2005
Requires entity classes which you can
build using the Object Relational Designer
(ORD)
Entity Framework will let you use LINQ
with other databases using E-R data
models
27
28. Using ORD (1 of 3)
Add to your App_Code folder
28
30. Using ORD (3 of 3)
Generated designer.cs file
30
31. Binding to a LINQ Query
Once the ORD created, you can
reference its DataContext
NorthwindDataContext db = new
NorthwindDataContext();
var results = from cust in db.Customers
where cust.Country == "USA"
orderby cust.CompanyName
select cust;
gvCustomers.DataSource = results;
gvCustomers.DataBind();
Example: CustomersGrid1.aspx
31
33. LINQ Tools
LINQPad
free tool for testing LINQ queries
from Joseph Albahari
http://www.linqpad.net/
LINQ Debug Visualizer
free download from Microsoft
http://www.scottgu.com/blogposts/linqquery/
sqlserverqueryvisualizer.zip
33
34. Selecting Fields
All fields (CustomersGrid1.aspx)
var results = from cust in db.Customers
select cust;
Subset of fields –notice use of "new"
to create anonymous type (CustomersGrid3.aspx)
var results = from cust in db.Customers
select new
{
cust.CompanyName,
cust.ContactName,
cust.City
};
34
35. Filtering Data
var results = from cust in db.Customers
where (cust.Country == "USA" &&
(cust.CompanyName.ToLower().StartsWith("t") ||
cust.CustomerID.ToLower().StartsWith("t")))
orderby cust.CompanyName
select cust;
Filter1.aspx
35
36. Using ORD Associations
ORD automatically adds associations for
database relationships
var results = from c in db.Customers
where c.Country == "USA"
select new
{
c.CompanyName,
c.City,
TotalOrders = c.Orders.Count,
LastOrder = c.Orders.Max(o => o.OrderDate)
};
Association1.aspx
36
37. Associations
You can always get to 1st order
associations
Getting to 2nd and 3rd order associations
requires you to compose your query so
that you traverse 1—m relationships from
the many side to the one side
Contrast
Association1.aspx, and
Association2.aspx
37
38. Ordering Data
// ascending is default order
var results = from cust in db.Customers
orderby cust.Country,
cust.Orders.Count descending
select new
{
cust.Country,
cust.City,
cust.CompanyName,
Orders = cust.Orders.Count
};
Order1.aspx
38
39. Joining Tables
var results = from order in db.Orders
join detail in db.Order_Details
on order.OrderID equals detail.OrderID
join product in db.Products
on detail.ProductID equals product.ProductID
join customer in db.Customers
on order.CustomerID equals customer.CustomerID
select new
{
customer.CompanyName,
order.OrderDate,
product.ProductName,
detail.UnitPrice,
Cost = detail.UnitPrice * detail.Quantity
};
Join1.aspx
39
40. Grouping Data
from d in db.Order_Details
from d in db.Order_Details
group new
group new
{
{
order = d.Order,
order = d.Order,
detail = d,
detail = d,
customer = d.Order.Customer
customer = d.Order.Customer
} by d.Order.Customer.CompanyName into grpQuery
} by d.Order.Customer.CompanyName into grpQuery
select new
select new
{
{
Company = grpQuery.Key,
Company = grpQuery.Key,
Purchases = grpQuery.Count(),
Purchases = grpQuery.Count(),
FirstOrder = grpQuery.Min(g => g.order.OrderDate),
FirstOrder = grpQuery.Min(g => g.order.OrderDate),
LastOrder = grpQuery.Max(g => g.order.OrderDate),
LastOrder = grpQuery.Max(g => g.order.OrderDate),
TotalCost = grpQuery.Sum(g => g.detail.Quantity * g.detail.UnitPrice)
TotalCost = grpQuery.Sum(g => g.detail.Quantity * g.detail.UnitPrice)
};
};
Group1.aspx
40
41. Calling Stored Procedure
Drag sproc from Server Explorer to data
model
Call sproc as method of data context
Example: CustomersFromSproc.aspx
var customersByCountry =
db.procCustomerSelectByCountry(ddlCountry.SelectedValue);
gv.DataSource = customersByCountry;
gv.DataBind();
41
42. Updating Data
Can update, of course, using sprocs
You can also use LinqDataSource control
Example: UpdateCategories1.aspx
You can also use an ObjectDataSource
control against a Data Access Layer (DAL)
Example: UpdateCategories2.aspx
see excerpt in later slide
This example also illustrates use of LINQ for
SQL Server data paging
42
44. Updating Data Example
public void Update(CategoryDAL cat2Update)
{
var cat = (from c in db.Categories
where (c.CategoryID == cat2Update.CategoryId)
select c).Single();
cat.CategoryName = cat2Update.CategoryName;
cat.Description = cat2Update.Description;
db.SubmitChanges();
}
44
45. SQL Server Data Paging
public List<CategoryDAL> Select(int startRowIndex, int maximumRows)
public List<CategoryDAL> Select(int startRowIndex, int maximumRows)
{
{
var cat = (from category in db.Categories
var cat = (from category in db.Categories
orderby category.CategoryID
orderby category.CategoryID
select new
select new
{
{
category.CategoryID,
category.CategoryID,
category.CategoryName,
category.CategoryName,
category.Description
category.Description
}).Skip(startRowIndex).Take(maximumRows);
}).Skip(startRowIndex).Take(maximumRows);
List<CategoryDAL> catList = new List<CategoryDAL>();
List<CategoryDAL> catList = new List<CategoryDAL>();
foreach (var c in cat)
foreach (var c in cat)
{
{
CategoryDAL cd = new CategoryDAL();
CategoryDAL cd = new CategoryDAL();
cd.CategoryId = c.CategoryID;
cd.CategoryId = c.CategoryID;
cd.CategoryName = c.CategoryName;
cd.CategoryName = c.CategoryName;
cd.Description = c.Description;
cd.Description = c.Description;
catList.Add(cd);
catList.Add(cd);
}
}
return catList;
return catList;
}
}
45
47. LINQ to DataSets (aka LINQ to ADO.NET)
Grab data from ADO.NET and put it into a
DataSet, DataTable
Use LINQ to shape the data
47
48. LINQ to DataSet Example
Example: LINQ2Dataset.aspx
cnx = new SqlConnection(strCnx);
cnx = new SqlConnection(strCnx);
sda = new SqlDataAdapter("procCustomersSelect", cnx);
sda = new SqlDataAdapter("procCustomersSelect", cnx);
sda.SelectCommand.CommandType = CommandType.StoredProcedure;
sda.SelectCommand.CommandType = CommandType.StoredProcedure;
dt = new DataTable();
dt = new DataTable();
sda.Fill(dt);
sda.Fill(dt);
var cust = from c in dt.AsEnumerable()
var cust = from c in dt.AsEnumerable()
orderby c.Field<string>("ContactName")
orderby c.Field<string>("ContactName")
select new
select new
{
{
Contact = c.Field<string>("ContactName"),
Contact = c.Field<string>("ContactName"),
Company = c.Field<string>("CompanyName"),
Company = c.Field<string>("CompanyName"),
Location = c.Field<string>("City") + ", " +
Location = c.Field<string>("City") + ", " +
c.Field<string>("Country")
c.Field<string>("Country")
};
};
48
49. Other LINQ Providers
LINQ to Entities
Takes O/RM much further than LINQ to SQL
Part of Visual Studio SP 1
49
50. Discussion Points
When are LINQ's strengths?
What are its weaknesses?
Is LINQ the future of data access in .NET?
Or is the more "classic" N-tier, ADO.NET,
stored procedures approach make more
sense in many scenarios?
50