I have create slides which lists examples of oops programming concepts including looping,enums,structures,linq,threading,delegates,generics,inheritenc..so on.
The document discusses Rust, a systems programming language developed by Mozilla. It provides an agenda, introduction to the speaker and company, why Rust was chosen, basic Rust concepts, and examples of Rust code. Memory safety is emphasized as Rust avoids vulnerabilities like memory leaks and use-after-free by using a borrow checker to validate references. Examples demonstrate immutable and mutable references, structs, functions, and memory management using Box to move values.
Rust
Why do you care about Rust? Who has the time to learn all these new languages? It seems like a new one is popping up every other week and this trend is growing at an exponential rate. Good news, a fair number of them are crafted really well and efficiently solve specific problems. Bad news, how do you keep up with all of this, let alone decide which languages to include in your companies technology portfolio.
Despite the challenges of all these new languages, a majority of developers are intrigued about the idea of becoming a polyglot, but don't know where to begin or don't have the time. In my polyglot travels, there is one language of late that is the sure-fire answer to the above questions, Rust.
In this talk I’ll explore the value behind becoming more polyglotic as a developer, how to pick languages to learn, and then dive deep in the the language of Rust. Which in my opinion, is hands down the best up and coming languages to learn.
About the Presenter
Anthony Broad-Crawford has been a developer since the year 2000 with a short side stint as a semi-professional poker player. Since his transition to software development Anthony has...
1. Built 8 patent receiving technologies
2. Founded two global companies
3. Been a CTO (3x), CPO (1x), and CEO (1x)
and is currently the CTO at Fooda where he manages product, user experience, and engineering. Fooda is predominantly web and mobile technology company focused on bringing great & healthy food from the best restaurant's to people while at the office.
Through his career, in production applications Anthony has used Ruby, Java, Jave (Android), Objective-C and Swift, .NET, Erlang, Scala, Node.JS, LISP, Smalltalk, and even assembly, with his recent favorite, Rust . No, not all at the same time in the same application.
Anthony now spends his time building great teams, that leverage great technology, to build great products, but still looks to codes every chance he can get :)
Asterisk: PVS-Studio Takes Up TelephonyAndrey Karpov
Asterisk is a software implementation of a telephone private branch exchange (PBX); it was created in 1999 by Mark Spencer of Digium. Like any PBX, it allows attached telephones to make calls to one another, and to connect to other telephone services, such as the public switched telephone network (PSTN) and Voice over Internet Protocol (VoIP) services. Its name comes from the asterisk symbol, *.
Asterisk is released under a dual license model, using the GNU General Public License (GPL) as a free software license and a proprietary software license to permit licensees to distribute proprietary, unpublished system components.
In this article, we are going to discuss the results of the check of the Asterisk project by PVS-Studio 5.18.
The project seems to be regularly checked by the Coverity analyzer, which is indicated by comments like this one:
/* Ignore check_return warning from Coverity for ast_exists_extension below */
However, I still found some disappointing typos in the code. Let's try to figure them out as well as other potential issues. The source code was downloaded from the project's SVN repository.
1. The document discusses Rust concepts like ownership, borrowing, cloning, copying, mutable references, threads and channels for parallelism, and shared memory using Arc and Mutex.
2. It provides examples of using ownership and borrowing rules to manage memory, spawning threads and using channels for inter-thread communication, and using Arc and Mutex for shared mutable memory across threads.
3. The document presents these concepts as part of an overview of Rust's approach for safe systems programming without fear of crashes or data races through its ownership and borrowing model.
This document provides an introduction to the Rust programming language. It describes that Rust was developed by Mozilla Research beginning in 2009 to combine the type safety of Haskell, concurrency of Erlang, and speed of C++. Rust reached version 1.0 in 2015 and is a generic, multiparadigm systems programming language that runs on platforms including ARM, Apple, Linux, Windows and embedded devices. It emphasizes security, performance and fine-grained memory safety without garbage collection.
This document provides an introduction to JavaScript basics including data types, variables, operators, flow control, objects, arrays, functions, regular expressions and classes/modules. It begins with an overview of JavaScript and its relationship to ECMAScript. It then covers JavaScript syntax, variables, data types like numbers, strings, Booleans, null/undefined, arrays and objects. Methods for manipulating strings and numbers are demonstrated. The document concludes with examples and exercises for practicing JavaScript fundamentals.
This document provides an overview of classes in C++. It begins with definitions and concepts related to classes, such as encapsulation and user-defined types. It then provides examples of declaring and defining a simple Time class with attributes like hours, minutes, seconds and methods to set, get, print and change the time. The document also discusses class members, access specifiers, constructors, pointers and references to class objects, and getter and setter methods. It concludes with brief mentions of utility functions, separating interface from implementation, and organizing classes across header and source files.
The document discusses hacking the Ruby parser parse.y to add new syntax features to the Ruby language. It covers several cases:
1. Adding :-) as an alias for => in hash literals.
2. Treating single quotes as symbol literals under certain conditions.
3. Adding ++ as an incremental operator.
4. Parsing the A#b syntax for defining instance methods.
The document analyzes how parse.y and the lexer deal with colons, quotes, comments and other syntax elements, and shows the changes needed to parse the new syntax features. It also discusses Ruby internals like the parser generator bison, and MRI implementation details like the parse.y file size.
sdlBasic is a basic interpreter that allows creating simple 2D games across multiple platforms like Linux, Windows, MacOS, and others. It uses the SDL library for graphics and allows working with sprites, sounds, user input and more. The interpreter was created by adapting and combining open source code distributed under licenses like GPL and LGPL.
This document discusses loops in C# and how to use different types of loops. It covers while loops, do-while loops, for loops, and foreach loops. It provides examples of calculating sums, factorials, products, powers, and checking for prime numbers. The document also discusses nested loops and how to use break, continue, and goto statements to control loop execution. Key loop concepts covered include initialization, test conditions, update expressions, and iterating over collections.
The document discusses functions in C++. It covers function prototypes, definitions, parameters, return types, and passing arguments to functions. Examples are provided of defining, declaring, calling functions, and common errors like missing return types or incorrect parameter types. Predefined functions from headers like sqrt() from cmath and rand() from cstdlib are also demonstrated.
Explaining ES6: JavaScript History and What is to ComeCory Forsyth
An overview of some of the history of JavaScript, how it became ECMAScript (and what Ecma is), as well as highlights of the new features and syntax in ES6 aka ES2015.
Originally presented to the New York Public Library on June 4 2015.
This document provides a history of ECMAScript (ES) and JavaScript standards. It discusses the origins of JavaScript in 1995 and its standardization by ECMA in 1997 as ECMAScript. New versions were released periodically, including ES5 in 2009 and ES6 in 2015. ES6 was also referred to as ES2015 since version names going forward would be based on the year of release.
The document discusses new C++11 features including:
1. Uniform initialization syntax using curly braces {} which can initialize objects in a clear and consistent way compared to parentheses () or equals =.
2. Initializer lists and how they allow initializing objects from a list of values. However, initializer lists may prefer certain constructors unintuitively.
3. How uniform initialization helps prevent narrowing conversions and most vexing parse issues that could occur in C++98 code.
The document summarizes the key features of ES6 (ECMAScript 2015), the next version of JavaScript. It discusses new features like block scoping with let and const, arrow functions, classes, enhanced object literals, template strings, and promises. It also covers iterators and generators, which allow iterable objects to be looped over and asynchronous code to be written more cleanly. The presentation provides examples to illustrate how developers can take advantage of these new language features in their code.
Pro typescript.ch03.Object Orientation in TypeScriptSeok-joon Yun
The document discusses object-oriented programming concepts in TypeScript such as classes, inheritance, polymorphism, and mixins. It provides code examples of implementing interfaces and classes to demonstrate inheritance and composition. Mixins are discussed as a way to reuse behavior across class hierarchies by applying multiple base classes to a derived class using a mixin function. The examples show how to define mixin behaviors as classes and apply them to implementing classes to achieve multiple inheritance in TypeScript.
Не так давно Гор Нишанов представил свой доклад: C++ Coroutines a negative overhead abstraction. В этом докладе Гор упомянул, что предложенный дизайн корутин позволяет их использовать практически в любых окружениях, в том числе и с "бедным" C++ рантаймом.
Я решил попробовать запустить корутины в следующих окружениях: обычное приложение, драйвер ОС Windows, EFI приложение. Только в одном из этих окружений есть полноценный C++ рантайм и поддержка исключений, в остальных ничего этого нет. Более того, EFI приложение вообще выполняется до старта ОС.
Я хочу рассказать о том, как мне удалось запустить корутины в этих окружениях, поговорим о том, какие проблемы существуют в асинхронном системном программировании и как их можно обойти.
This document discusses why Rust is a useful programming language. It provides an introduction to Rust, highlighting its memory safety features, ownership and borrowing system, and functional programming aspects like iterators and closures. Examples are given to demonstrate how Rust prevents common bugs like dangling pointers and iterator invalidation. The talk also covers Rust's type system, enums, patterns matching, and its Cargo package manager.
The document discusses ECMAScript 6 (ES6), a major update to JavaScript. It describes new features added in five acts, including modules, syntax enhancements, classes, functions improvements, and tools for compiling ES6 to older JavaScript versions. Key additions are modules, classes, arrow functions, let/const variables, template literals, and promises to support asynchronous programming. Compilers like Babel allow using ES6 features while targeting older JavaScript environments.
The document discusses the Apache Commons project, which develops reusable Java components. It notes that Commons components allow for faster and smaller development by avoiding reinventing common functions. The document outlines several active Commons components like Collections, IO, Lang, and Logging, as well as sandbox and dormant components. It emphasizes that 80% of Commons components have no dependencies on each other, promoting flexibility and reuse.
A reworking of my 2010 RubyConf lightning talk introducing Go via a concurrent implementation of MapReduce. This code is probably buggy as hell and the design awful but it's also a reasonably good intro to the full breadth of Go.
This document discusses various concepts in shell programming including the use of semicolons, colons, test commands for strings and integers, while and until loops, command line arguments, variables, reading input, case statements, and redirection. Key points covered include using semicolons to separate statements, the colon command doing nothing, testing strings for length and equality, comparing integers, accessing command line arguments, and redirecting standard input/output/error.
This document discusses various concepts in shell programming including the use of semicolons, colons, test commands for strings and integers, while and until loops, command line arguments, variables, reading input, case statements, and redirection. Key points covered include using semicolons to separate statements, the colon command doing nothing, testing strings for length and equality, comparing integers, accessing command line arguments, and redirecting standard input/output/error.
The document summarizes changes and additions in Clojure 1.1 and beyond. Key changes include replacing watchers with add-watch/remove-watch, removing add-classpath, deprecating ^ in favor of meta, reworking clojure.parallel to use Java 7 fork-join, and replacing clojure.lang.Repl and clojure.lang.Script with clojure.main. Additions include primitive array generation/casting, chunked sequences, futures, promises, transients, pre-/post- conditions, and new namespaces like clojure.test. Future versions may include reify, deftype, defprotocol, fine-grained locals clearing, and agent
This document summarizes new features in Swift 2 including guard/defer statements for flow control, protocol extensions for default implementations, and error handling improvements like throwing and catching errors. It also mentions Swift becoming open source with its source code released under a permissive license and contributions accepted from the community, including ports for Linux. Nest is provided as an example open source Swift web framework project on GitHub.
Implementing Software Machines in C and GoEleanor McHugh
The next iteration of the talk I gave at Progscon, this introduces examples of Map implementation (useful for caches etc.) and outlines for addition of processor core code in a later talk.
NativeBoost is a library that allows Pharo code to interface with native code written in C/C++. It provides functions for calling external functions, handling basic data types, and working with structures. The tutorial demonstrates how to use NativeBoost to interface with the Chipmunk physics library from within Pharo. It shows defining types for structures like vectors, calling functions, and dealing with indirect function calls through pointers. Understanding native libraries, data types, and structures is necessary to interface Pharo with external C code using NativeBoost.
- The document discusses structs in C++, including defining structs, initializing struct variables, accessing struct members, passing structs as function parameters, and using pointers to structs.
- Key aspects covered include that structs allow grouping of related data of different types, struct definitions do not allocate memory, and struct variables are initialized and accessed using dot notation. Structs can be passed by value or by reference to functions. Pointers can be used to point to struct variables.
This document summarizes a research paper on using active power filters to reduce total harmonic distortion. It provides background on power quality issues caused by harmonics from nonlinear loads. Active power filters inject harmonic currents to cancel out load harmonics. The document describes shunt and series active power filters and their control methods. Simulation results show that a shunt active power filter can reduce the voltage THD from 17.92% to 11.46% and current THD from 0.53% to 0.46% for an AC-DC converter feeding an R-L load. Thus, active power filters are effective in mitigating harmonics and improving power quality.
This document summarizes a journal article about a traffic light control system using radio frequency (RF) for emergency vehicles. The system uses an RF transmitter in emergency vehicles that sends a signal to an RF receiver at an intersection. When the receiver gets the emergency signal, it overrides the normal traffic light sequence and changes the light for the emergency vehicle to green for a set time. This allows emergency vehicles to pass through intersections more quickly. The system was tested up to a range of 20 meters outdoors and 30 meters indoors using a 434MHz RF module and PIC microcontroller. The system aims to help reduce accidents by giving emergency vehicles priority at traffic lights.
sdlBasic is a basic interpreter that allows creating simple 2D games across multiple platforms like Linux, Windows, MacOS, and others. It uses the SDL library for graphics and allows working with sprites, sounds, user input and more. The interpreter was created by adapting and combining open source code distributed under licenses like GPL and LGPL.
This document discusses loops in C# and how to use different types of loops. It covers while loops, do-while loops, for loops, and foreach loops. It provides examples of calculating sums, factorials, products, powers, and checking for prime numbers. The document also discusses nested loops and how to use break, continue, and goto statements to control loop execution. Key loop concepts covered include initialization, test conditions, update expressions, and iterating over collections.
The document discusses functions in C++. It covers function prototypes, definitions, parameters, return types, and passing arguments to functions. Examples are provided of defining, declaring, calling functions, and common errors like missing return types or incorrect parameter types. Predefined functions from headers like sqrt() from cmath and rand() from cstdlib are also demonstrated.
Explaining ES6: JavaScript History and What is to ComeCory Forsyth
An overview of some of the history of JavaScript, how it became ECMAScript (and what Ecma is), as well as highlights of the new features and syntax in ES6 aka ES2015.
Originally presented to the New York Public Library on June 4 2015.
This document provides a history of ECMAScript (ES) and JavaScript standards. It discusses the origins of JavaScript in 1995 and its standardization by ECMA in 1997 as ECMAScript. New versions were released periodically, including ES5 in 2009 and ES6 in 2015. ES6 was also referred to as ES2015 since version names going forward would be based on the year of release.
The document discusses new C++11 features including:
1. Uniform initialization syntax using curly braces {} which can initialize objects in a clear and consistent way compared to parentheses () or equals =.
2. Initializer lists and how they allow initializing objects from a list of values. However, initializer lists may prefer certain constructors unintuitively.
3. How uniform initialization helps prevent narrowing conversions and most vexing parse issues that could occur in C++98 code.
The document summarizes the key features of ES6 (ECMAScript 2015), the next version of JavaScript. It discusses new features like block scoping with let and const, arrow functions, classes, enhanced object literals, template strings, and promises. It also covers iterators and generators, which allow iterable objects to be looped over and asynchronous code to be written more cleanly. The presentation provides examples to illustrate how developers can take advantage of these new language features in their code.
Pro typescript.ch03.Object Orientation in TypeScriptSeok-joon Yun
The document discusses object-oriented programming concepts in TypeScript such as classes, inheritance, polymorphism, and mixins. It provides code examples of implementing interfaces and classes to demonstrate inheritance and composition. Mixins are discussed as a way to reuse behavior across class hierarchies by applying multiple base classes to a derived class using a mixin function. The examples show how to define mixin behaviors as classes and apply them to implementing classes to achieve multiple inheritance in TypeScript.
Не так давно Гор Нишанов представил свой доклад: C++ Coroutines a negative overhead abstraction. В этом докладе Гор упомянул, что предложенный дизайн корутин позволяет их использовать практически в любых окружениях, в том числе и с "бедным" C++ рантаймом.
Я решил попробовать запустить корутины в следующих окружениях: обычное приложение, драйвер ОС Windows, EFI приложение. Только в одном из этих окружений есть полноценный C++ рантайм и поддержка исключений, в остальных ничего этого нет. Более того, EFI приложение вообще выполняется до старта ОС.
Я хочу рассказать о том, как мне удалось запустить корутины в этих окружениях, поговорим о том, какие проблемы существуют в асинхронном системном программировании и как их можно обойти.
This document discusses why Rust is a useful programming language. It provides an introduction to Rust, highlighting its memory safety features, ownership and borrowing system, and functional programming aspects like iterators and closures. Examples are given to demonstrate how Rust prevents common bugs like dangling pointers and iterator invalidation. The talk also covers Rust's type system, enums, patterns matching, and its Cargo package manager.
The document discusses ECMAScript 6 (ES6), a major update to JavaScript. It describes new features added in five acts, including modules, syntax enhancements, classes, functions improvements, and tools for compiling ES6 to older JavaScript versions. Key additions are modules, classes, arrow functions, let/const variables, template literals, and promises to support asynchronous programming. Compilers like Babel allow using ES6 features while targeting older JavaScript environments.
The document discusses the Apache Commons project, which develops reusable Java components. It notes that Commons components allow for faster and smaller development by avoiding reinventing common functions. The document outlines several active Commons components like Collections, IO, Lang, and Logging, as well as sandbox and dormant components. It emphasizes that 80% of Commons components have no dependencies on each other, promoting flexibility and reuse.
A reworking of my 2010 RubyConf lightning talk introducing Go via a concurrent implementation of MapReduce. This code is probably buggy as hell and the design awful but it's also a reasonably good intro to the full breadth of Go.
This document discusses various concepts in shell programming including the use of semicolons, colons, test commands for strings and integers, while and until loops, command line arguments, variables, reading input, case statements, and redirection. Key points covered include using semicolons to separate statements, the colon command doing nothing, testing strings for length and equality, comparing integers, accessing command line arguments, and redirecting standard input/output/error.
This document discusses various concepts in shell programming including the use of semicolons, colons, test commands for strings and integers, while and until loops, command line arguments, variables, reading input, case statements, and redirection. Key points covered include using semicolons to separate statements, the colon command doing nothing, testing strings for length and equality, comparing integers, accessing command line arguments, and redirecting standard input/output/error.
The document summarizes changes and additions in Clojure 1.1 and beyond. Key changes include replacing watchers with add-watch/remove-watch, removing add-classpath, deprecating ^ in favor of meta, reworking clojure.parallel to use Java 7 fork-join, and replacing clojure.lang.Repl and clojure.lang.Script with clojure.main. Additions include primitive array generation/casting, chunked sequences, futures, promises, transients, pre-/post- conditions, and new namespaces like clojure.test. Future versions may include reify, deftype, defprotocol, fine-grained locals clearing, and agent
This document summarizes new features in Swift 2 including guard/defer statements for flow control, protocol extensions for default implementations, and error handling improvements like throwing and catching errors. It also mentions Swift becoming open source with its source code released under a permissive license and contributions accepted from the community, including ports for Linux. Nest is provided as an example open source Swift web framework project on GitHub.
Implementing Software Machines in C and GoEleanor McHugh
The next iteration of the talk I gave at Progscon, this introduces examples of Map implementation (useful for caches etc.) and outlines for addition of processor core code in a later talk.
NativeBoost is a library that allows Pharo code to interface with native code written in C/C++. It provides functions for calling external functions, handling basic data types, and working with structures. The tutorial demonstrates how to use NativeBoost to interface with the Chipmunk physics library from within Pharo. It shows defining types for structures like vectors, calling functions, and dealing with indirect function calls through pointers. Understanding native libraries, data types, and structures is necessary to interface Pharo with external C code using NativeBoost.
- The document discusses structs in C++, including defining structs, initializing struct variables, accessing struct members, passing structs as function parameters, and using pointers to structs.
- Key aspects covered include that structs allow grouping of related data of different types, struct definitions do not allocate memory, and struct variables are initialized and accessed using dot notation. Structs can be passed by value or by reference to functions. Pointers can be used to point to struct variables.
This document summarizes a research paper on using active power filters to reduce total harmonic distortion. It provides background on power quality issues caused by harmonics from nonlinear loads. Active power filters inject harmonic currents to cancel out load harmonics. The document describes shunt and series active power filters and their control methods. Simulation results show that a shunt active power filter can reduce the voltage THD from 17.92% to 11.46% and current THD from 0.53% to 0.46% for an AC-DC converter feeding an R-L load. Thus, active power filters are effective in mitigating harmonics and improving power quality.
This document summarizes a journal article about a traffic light control system using radio frequency (RF) for emergency vehicles. The system uses an RF transmitter in emergency vehicles that sends a signal to an RF receiver at an intersection. When the receiver gets the emergency signal, it overrides the normal traffic light sequence and changes the light for the emergency vehicle to green for a set time. This allows emergency vehicles to pass through intersections more quickly. The system was tested up to a range of 20 meters outdoors and 30 meters indoors using a 434MHz RF module and PIC microcontroller. The system aims to help reduce accidents by giving emergency vehicles priority at traffic lights.
This document discusses distributed firewalls as an alternative to traditional firewalls. It provides an overview of distributed firewalls, including that they allow security policies to be centrally defined but enforced across individual endpoints. The key advantages of distributed firewalls are that they do not depend on network topology, protect from internal threats, and avoid bottlenecks since there are multiple secure entry points rather than a single point of failure. The document also reviews related work on distributed firewalls and some of their disadvantages, such as increased complexity if the central management system is compromised.
This document summarizes a survey on attacks against mobile ad hoc networks (MANETs). It begins with an introduction to MANETs and discusses their unique characteristics and vulnerabilities. It then categorizes the different types of attacks that can occur in MANETs based on their nature (active vs passive), location (external vs internal), and which layer of the protocol stack they target (physical, data link, network, transport, etc.). Specific attacks are defined at each level. The document aims to provide an overview of the security issues in MANETs and different classifications of attacks.
El documento discute la relación entre el diseño y la cultura. Explica que el diseño refleja la historia y cultura humana y puede usarse para desarrollar habilidades e instituciones. También señala que el diseño contribuye al bienestar humano a través de la calidad de los productos y servicios. Finalmente, concluye que la relación entre diseño y cultura ha cambiado en los últimos años para fomentar la innovación y el desarrollo.
This document discusses the processing of end-of-life vehicles (ELVs) in India compared to other countries like the US and Canada. It outlines the typical 3-stage ELV processing process of draining fluids, removing reusable parts, and crushing the remaining vehicle. While countries like the US and Canada have standardized recycling programs and track reusable parts, India lacks formal regulations and infrastructure for proper ELV disposal. The document argues that India should adopt innovative recycling techniques to minimize pollution, save resources, and improve worker safety when processing the growing number of ELVs.
This document summarizes current research on morphological analysis techniques for the Assamese language. It discusses prior work using rule-based and unsupervised methods for morphological analysis of several Indian languages, including Hindi, Bengali, Punjabi, Marathi, Tamil, Malayalam, Kannada, and Assamese. For Assamese specifically, it describes several studies that used suffix stripping and rule-based approaches to develop morphological analyzers, as well as some initial work on unsupervised techniques. The document concludes that while most existing work on Assamese has used supervised suffix stripping methods, unsupervised techniques show promise but have not been fully explored.
This document describes a secure file hosting application that uses encryption and compression algorithms. The application allows users to upload files from their device without needing a web browser. The uploaded files are encrypted and compressed before being stored on the server. When users want to download a file, the reverse process of decompression and decryption is performed. The architecture involves a server to store encrypted user files and a client application for file uploads and downloads. Security mechanisms like AES encryption are used to securely transmit files between client and server.
This document describes two techniques for designing optical XNOR and NAND logic gates. The first technique uses a 2D array of coupled optical cavities with Kerr nonlinearity. Discrete cavity solitons are numerically simulated and used to demonstrate optical XNOR and NAND gates by controlling soliton interactions with a Gaussian beam. The second technique uses multi-mode interference waveguides to convert the phase of binary-phase-shift keying input signals to amplitude at the output, implementing optical XNOR and NAND logic. Numerical simulations using the finite element method show contrast ratios of 21.5 dB for the XNOR gate and 22.3 dB for the NAND gate.
This document summarizes the plant-mediated synthesis and characterization of silver nanoparticles using extracts from Ocimum sanctum (Tulsi) and Parthenium hysterophorous (Congress grass) plant leaves. Silver nanoparticles were synthesized using aqueous extracts of the two plants reacted with silver nitrate solutions. The synthesized nanoparticles were characterized using UV-Vis spectroscopy, SEM, EDX and DLS. UV-Vis analysis showed surface plasmon resonance peaks between 406-446 nm indicating silver nanoparticle formation. SEM images showed uniformly distributed nanoparticles on average sizes of 68.74 nm and 108.6 nm for Tulsi and Congress grass samples respectively, which was confirmed by DLS and EDX showed presence of silver. Applications testing of
This document summarizes a research paper on visual cryptography, which is a technique that allows information like images and text to be encrypted in a way that can be decrypted by the human visual system without using computers. It discusses how visual cryptography works by splitting a secret image into random shares, such that overlaying the shares reveals the original secret image. The document then describes the specific SDS algorithm used in the paper for keyless image encryption by sieving, dividing, and shuffling the image pixels into multiple random shares. It concludes by discussing potential applications and areas for further research on visual cryptography.
This document presents a new design for a reversible fault tolerant carry skip adder/subtractor using pipelining technology. It first describes previous designs for a full adder/subtractor, parallel adder/subtractor, and carry skip adder/subtractor. It then presents the proposed design which uses a new fault tolerant full adder/subtractor block, and applies pipelining to the parallel and carry skip adder/subtractor designs. Simulation results show the proposed designs have lower delay and complexity compared to previous versions, with the carry skip adder/subtractor being 68% faster and 65% less complex. The document concludes the proposed pipelined carry skip adder/subtractor achieves a more
This document summarizes a numerical study that examines the effects of fin spacing, fin material, and jet velocity on the heat transfer performance of plate fin heat sinks cooled by impinging air jets. The study considers fin spacings of 2mm, 3mm, and 4mm, and fin materials of aluminum, copper, and steel. Jet velocities of 5m/s, 10m/s, and 15m/s are examined. The results show that heat transfer rate increases with decreasing fin spacing, higher thermal conductivity fin materials like copper, and increasing jet velocity. Copper fins achieved the highest heat transfer rates but are heavier and more expensive than aluminum. A fin spacing of 2mm with aluminum fins and a jet velocity of 15
This document contains facts about Rachael H. and Ukraine. It provides biographical details about Rachael, such as where she is from, her major, and hobbies. Regarding Ukraine, it notes that the country gained independence in 1991 from the Soviet Union and experienced political and economic turmoil following this. It also discusses issues Ukraine has faced with human trafficking after independence and how Ukrainian women are particularly vulnerable to being trafficked.
The document describes using a Kalman filter for road map estimation and extended target tracking. It presents a framework that models extended objects using polynomials based on imagery sensor data. State-space models allow the use of Kalman filters for tracking. The Kalman filter provides optimal, recursive estimates by minimizing estimated error covariance. It predicts the next state and corrects the estimate based on new measurements. Simulation results demonstrate tracking an object using the Kalman filter compared to a conventional method.
1) The document presents an integrated technique for detecting brain tumors in MRI images that combines modified texture-based region growing segmentation and edge detection.
2) The technique first performs pre-processing on MRI images, then uses modified texture-based region growing to segment regions. It then applies edge detection to extract the tumor region.
3) Experimental results show the integrated technique provides more accurate tumor detection compared to individual segmentation methods and manual segmentation.
This document describes a USB driver embedded controller that was developed using embedded C. It functions as a USB host to allow data transfer from an application system to a USB storage device like a pen drive. The controller uses a PIC microcontroller with a USB interface and can store data input through a keypad in its memory. When a USB storage device is connected, it transfers the stored data files to the device. This embedded controller provides advantages over traditional data logging systems as it is portable, low cost, and does not require a computer to be mounted near the application system. The document discusses the implementation of the controller and the development of the USB device driver in more detail.
This document reviews alternative thermal barrier coatings for diesel engines. It discusses how thermal barrier coatings can increase combustion chamber temperatures, improving engine efficiency and reducing emissions. Several alternative coating materials are described that have properties suitable for thermal barrier coatings, such as low thermal conductivity and high thermal stability at high temperatures. These include zirconates, garnets, yttria stabilized zirconia, and oxides from the alumina-silica-magnesia system like cordierite, forsterite, spinel, and mullite. The document also reviews the potential benefits of thermal barrier coatings, such as reduced fuel consumption and increased engine efficiency, as well as some challenges in fully realizing these benefits.
This document summarizes research on visual cryptography for securing black and white images. It discusses how visual cryptography works by breaking up a secret image into shares such that stacking the shares reveals the secret image to the human visual system without computation. The document also outlines Naor and Shamir's original (2,2) visual cryptography scheme and discusses extensions to the scheme including supporting multiple secrets and improving image quality and size. Finally, it notes that visual cryptography provides robust security for images while eliminating the need for computers during decryption.
The document discusses various programming concepts in C# such as data types, control flow statements like if/else, switch, loops (for, while, do-while), methods for generating random numbers, and examples of programming problems involving calculations, patterns, and simulating dice rolls. Random numbers can be generated using the Random class, control structures conditionally execute blocks of code, and loops iterate code for a set number of repetitions.
C++ and OOPS Crash Course by ACM DBIT | Grejo JobyGrejoJoby1
The slides from the C++ and OOPS Crash Course conducted for ACM DBIT by Grejo Joby.
Learn the concepts of OOPS and C++ Programming in the shortest time with these notes.
The document discusses various programming concepts in C# such as random number generation, Boolean expressions, control statements like if/else, switch, for, while and do-while loops. It also covers nested loops, break and continue statements, and provides examples of problems that can be solved using these programming constructs like generating random numbers, printing patterns, and simulating dice rolls.
The document discusses different types of loops in programming including while, do-while, and for loops. A while loop repeatedly executes a block of code as long as a given condition is true. A do-while loop is similar but checks the condition after executing the code block. A for loop allows initialization of a counter variable, a condition to test each iteration, and an update to the counter variable between iterations. Examples are provided of each type of loop to illustrate their usage.
The presentation helps us in understanding the different concepts associated with TypeScript. What is TypeScript? Why is TypeScript used and the different applications of TypeScript. For more information you can simply visit: http://mobile.folio3.com/
The document provides information about object-oriented programming languages and concepts. It discusses source code, object code, operators, data types, input/output streams, preprocessor directives, loops, decision statements, and variables. Some key points include:
- Source code is written by programmers in a human-readable language, which is then compiled into machine-readable object code.
- Common operators include math, comparison, and logical operators. Data types include integral, floating-point, and enumeration types.
- Loops like for, while, and do-while are used for repetition. Decision statements include if-else and switch-case.
- Preprocessor directives start with # and are commands for the preprocessor
This document provides an overview of key concepts in the Java programming language, including:
- Java is an object-oriented language that is simpler than C++ and supports features like platform independence.
- The Java development environment includes tools for compiling, debugging, and running Java programs.
- Java programs work with basic data types like int and double, as well as user-defined classes, variables, and arrays.
- The document explains operators, control structures, formatting output, and the basics of classes and objects in Java.
Java is a cross-platform language originally developed by James Gosling at Sun Microsystems. It enables writing programs for many operating systems using a C/C++-like syntax but with a simpler object model and fewer low-level facilities. Java programs are compiled to bytecode that can run on any Java Virtual Machine (JVM) regardless of computer architecture. Common Java development tools include Eclipse and NetBeans integrated development environments.
In this chapter we will examine the loop programming constructs through which we can execute a code snippet repeatedly. We will discuss how to implement conditional repetitions (while and do-while loops) and how to work with for-loops. We will give examples of different possibilities to define loops, how to construct them and some of their key usages. Finally, we will discuss the foreach-loop construct and how we can use multiple loops placed inside each other (nested loops).
The document provides an overview of the C programming language. It states that C was developed in 1972 by Dennis Ritchie at Bell Labs and was used to develop the UNIX operating system. The document then covers various features of C like it being a mid-level programming language, having structured programming, pointers, loops, functions, arrays, and more. It provides examples to explain concepts like input/output functions, data types, operators, control structures, and pointers.
Object oriented programming system with C++msharshitha03s
This document provides an overview of C++ control statements, functions, and storage classes. It discusses various loops like while, for, and do-while loops. It also covers decision making statements such as if-else, if-else-if-else, switch statements, and unconditional statements like break, continue, and goto. The document then discusses functions, recursion, and inline functions. Finally, it summarizes different storage classes in C++ like auto, register, static, external, and mutable and provides examples of each.
This document provides an introduction to learning Java, including:
- An overview of Java as an object-oriented language developed by Sun Microsystems, featuring a virtual machine, portability, and memory management.
- Instructions for compiling and running a simple "Hello World" Java program from the command line.
- Explanations of Java programming basics like classes, methods, variables, operators, and control structures.
This document contains the source code for a Java program that demonstrates various programming concepts to a user through a conversational interface. It walks the user through examples of data types, variables, input/output, mathematical operations, conditional statements, arrays and more. It collects user input, performs calculations, and provides feedback and explanations at each step. The overall purpose is to educate the user about basic Java programming concepts in an interactive way.
Templates allow functions and classes to work with different data types. Template classes define generic class definitions that can be used for multiple types, while template functions define generic functions. When a template is instantiated, actual code is generated for the specific types used. Exceptions provide a mechanism to handle runtime errors in C++ and are used by enclosing code that may throw exceptions in a try block and catching specific exceptions in catch blocks.
C# is an object-oriented programming language derived from C, C++ and Java. The document discusses various C# concepts including control structures like decision statements (if, if-else, switch) and iteration statements (for, foreach, while, do-while loops). It also covers arrays, generics, and namespaces. Generics provide type safety and flexibility by separating the logic from data type. Namespaces help organize code and avoid class name clashes.
Game Design and Development Workshop Day 1Troy Miles
This course teaches you how to build awesome video games using Cocos2Dx. Cocos2Dx is a feature packed, free game development engine. It is cross platform, high performance, and supports three languages: C++, Lua and JavaScript. With it, you can write games for iOS, Android, Windows, Mac, and the Web. It is nothing short of amazing and this course teaches you how to use it. We will program Cocos2Dx in JavaScript, but this is not a programming class. If you don't know how to write code in JavaScript or some other curly brace language, this is not the course for you. For those whose JavaScript is rusty, we will do quick language overview. Don't let the JavaScript part fool you. Cocos2Dx is built from highly optimized C++ and OpenGL, JavaScript is used for game logic, not graphics. Our games will run at a super fast, 60 frames a second.
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungenpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-nomad-web-best-practices-und-verwaltung-von-multiuser-umgebungen/
HCL Nomad Web wird als die nächste Generation des HCL Notes-Clients gefeiert und bietet zahlreiche Vorteile, wie die Beseitigung des Bedarfs an Paketierung, Verteilung und Installation. Nomad Web-Client-Updates werden “automatisch” im Hintergrund installiert, was den administrativen Aufwand im Vergleich zu traditionellen HCL Notes-Clients erheblich reduziert. Allerdings stellt die Fehlerbehebung in Nomad Web im Vergleich zum Notes-Client einzigartige Herausforderungen dar.
Begleiten Sie Christoph und Marc, während sie demonstrieren, wie der Fehlerbehebungsprozess in HCL Nomad Web vereinfacht werden kann, um eine reibungslose und effiziente Benutzererfahrung zu gewährleisten.
In diesem Webinar werden wir effektive Strategien zur Diagnose und Lösung häufiger Probleme in HCL Nomad Web untersuchen, einschließlich
- Zugriff auf die Konsole
- Auffinden und Interpretieren von Protokolldateien
- Zugriff auf den Datenordner im Cache des Browsers (unter Verwendung von OPFS)
- Verständnis der Unterschiede zwischen Einzel- und Mehrbenutzerszenarien
- Nutzung der Client Clocking-Funktion
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxAnoop Ashok
In today's fast-paced retail environment, efficiency is key. Every minute counts, and every penny matters. One tool that can significantly boost your store's efficiency is a well-executed planogram. These visual merchandising blueprints not only enhance store layouts but also save time and money in the process.
Spark is a powerhouse for large datasets, but when it comes to smaller data workloads, its overhead can sometimes slow things down. What if you could achieve high performance and efficiency without the need for Spark?
At S&P Global Commodity Insights, having a complete view of global energy and commodities markets enables customers to make data-driven decisions with confidence and create long-term, sustainable value. 🌍
Explore delta-rs + CDC and how these open-source innovations power lightweight, high-performance data applications beyond Spark! 🚀
HCL Nomad Web – Best Practices and Managing Multiuser Environmentspanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-nomad-web-best-practices-and-managing-multiuser-environments/
HCL Nomad Web is heralded as the next generation of the HCL Notes client, offering numerous advantages such as eliminating the need for packaging, distribution, and installation. Nomad Web client upgrades will be installed “automatically” in the background. This significantly reduces the administrative footprint compared to traditional HCL Notes clients. However, troubleshooting issues in Nomad Web present unique challenges compared to the Notes client.
Join Christoph and Marc as they demonstrate how to simplify the troubleshooting process in HCL Nomad Web, ensuring a smoother and more efficient user experience.
In this webinar, we will explore effective strategies for diagnosing and resolving common problems in HCL Nomad Web, including
- Accessing the console
- Locating and interpreting log files
- Accessing the data folder within the browser’s cache (using OPFS)
- Understand the difference between single- and multi-user scenarios
- Utilizing Client Clocking
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul
Artificial intelligence is changing how businesses operate. Companies are using AI agents to automate tasks, reduce time spent on repetitive work, and focus more on high-value activities. Noah Loul, an AI strategist and entrepreneur, has helped dozens of companies streamline their operations using smart automation. He believes AI agents aren't just tools—they're workers that take on repeatable tasks so your human team can focus on what matters. If you want to reduce time waste and increase output, AI agents are the next move.
Vaibhav Gupta BAML: AI work flows without Hallucinationsjohn409870
Shipping Agents
Vaibhav Gupta
Cofounder @ Boundary
in/vaigup
boundaryml/baml
Imagine if every API call you made
failed only 5% of the time
boundaryml/baml
Imagine if every LLM call you made
failed only 5% of the time
boundaryml/baml
Imagine if every LLM call you made
failed only 5% of the time
boundaryml/baml
Fault tolerant systems are hard
but now everything must be
fault tolerant
boundaryml/baml
We need to change how we
think about these systems
Aaron Villalpando
Cofounder @ Boundary
Boundary
Combinator
boundaryml/baml
We used to write websites like this:
boundaryml/baml
But now we do this:
boundaryml/baml
Problems web dev had:
boundaryml/baml
Problems web dev had:
Strings. Strings everywhere.
boundaryml/baml
Problems web dev had:
Strings. Strings everywhere.
State management was impossible.
boundaryml/baml
Problems web dev had:
Strings. Strings everywhere.
State management was impossible.
Dynamic components? forget about it.
boundaryml/baml
Problems web dev had:
Strings. Strings everywhere.
State management was impossible.
Dynamic components? forget about it.
Reuse components? Good luck.
boundaryml/baml
Problems web dev had:
Strings. Strings everywhere.
State management was impossible.
Dynamic components? forget about it.
Reuse components? Good luck.
Iteration loops took minutes.
boundaryml/baml
Problems web dev had:
Strings. Strings everywhere.
State management was impossible.
Dynamic components? forget about it.
Reuse components? Good luck.
Iteration loops took minutes.
Low engineering rigor
boundaryml/baml
React added engineering rigor
boundaryml/baml
The syntax we use changes how we
think about problems
boundaryml/baml
We used to write agents like this:
boundaryml/baml
Problems agents have:
boundaryml/baml
Problems agents have:
Strings. Strings everywhere.
Context management is impossible.
Changing one thing breaks another.
New models come out all the time.
Iteration loops take minutes.
boundaryml/baml
Problems agents have:
Strings. Strings everywhere.
Context management is impossible.
Changing one thing breaks another.
New models come out all the time.
Iteration loops take minutes.
Low engineering rigor
boundaryml/baml
Agents need
the expressiveness of English,
but the structure of code
F*** You, Show Me The Prompt.
boundaryml/baml
<show don’t tell>
Less prompting +
More engineering
=
Reliability +
Maintainability
BAML
Sam
Greg Antonio
Chris
turned down
openai to join
ex-founder, one
of the earliest
BAML users
MIT PhD
20+ years in
compilers
made his own
database, 400k+
youtube views
Vaibhav Gupta
in/vaigup
[email protected]
boundaryml/baml
Thank you!
Quantum Computing Quick Research Guide by Arthur MorganArthur Morgan
This is a Quick Research Guide (QRG).
QRGs include the following:
- A brief, high-level overview of the QRG topic.
- A milestone timeline for the QRG topic.
- Links to various free online resource materials to provide a deeper dive into the QRG topic.
- Conclusion and a recommendation for at least two books available in the SJPL system on the QRG topic.
QRGs planned for the series:
- Artificial Intelligence QRG
- Quantum Computing QRG
- Big Data Analytics QRG
- Spacecraft Guidance, Navigation & Control QRG (coming 2026)
- UK Home Computing & The Birth of ARM QRG (coming 2027)
Any questions or comments?
- Please contact Arthur Morgan at [email protected].
100% human made.
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025BookNet Canada
Book industry standards are evolving rapidly. In the first part of this session, we’ll share an overview of key developments from 2024 and the early months of 2025. Then, BookNet’s resident standards expert, Tom Richardson, and CEO, Lauren Stewart, have a forward-looking conversation about what’s next.
Link to recording, transcript, and accompanying resource: https://bnctechforum.ca/sessions/standardsgoals-for-2025-standards-certification-roundup/
Presented by BookNet Canada on May 6, 2025 with support from the Department of Canadian Heritage.
This is the keynote of the Into the Box conference, highlighting the release of the BoxLang JVM language, its key enhancements, and its vision for the future.
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc
Most consumers believe they’re making informed decisions about their personal data—adjusting privacy settings, blocking trackers, and opting out where they can. However, our new research reveals that while awareness is high, taking meaningful action is still lacking. On the corporate side, many organizations report strong policies for managing third-party data and consumer consent yet fall short when it comes to consistency, accountability and transparency.
This session will explore the research findings from TrustArc’s Privacy Pulse Survey, examining consumer attitudes toward personal data collection and practical suggestions for corporate practices around purchasing third-party data.
Attendees will learn:
- Consumer awareness around data brokers and what consumers are doing to limit data collection
- How businesses assess third-party vendors and their consent management operations
- Where business preparedness needs improvement
- What these trends mean for the future of privacy governance and public trust
This discussion is essential for privacy, risk, and compliance professionals who want to ground their strategies in current data and prepare for what’s next in the privacy landscape.
Role of Data Annotation Services in AI-Powered ManufacturingAndrew Leo
From predictive maintenance to robotic automation, AI is driving the future of manufacturing. But without high-quality annotated data, even the smartest models fall short.
Discover how data annotation services are powering accuracy, safety, and efficiency in AI-driven manufacturing systems.
Precision in data labeling = Precision on the production floor.
Unlocking the Power of IVR: A Comprehensive Guidevikasascentbpo
Streamline customer service and reduce costs with an IVR solution. Learn how interactive voice response systems automate call handling, improve efficiency, and enhance customer experience.
Heap, Types of Heap, Insertion and DeletionJaydeep Kale
Oops pramming with examples
1. I have created a sample console application which lists all oops related examples like
types,inheritence ,interface,sealed,delegates,enum,threading,linq,regular
expressions,extension methods,generics,arrays,list...so on.
just copy and run your application in console and see the output..
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
namespace CSharpAndMe
{
class Program
{
enum Days { Sun, Mon, tue, Wed, thu, Fri, Sat };
static void Main(string[] args)
{
// Derived d = new Base();
Base b = new Derived();
b.print();
b.display();
Derived d1 = new Derived();
d1.display();
//TODO: understanding string type
//Defination: Nearly every program uses strings.
//In strings, we find characters, words and textual data. The string type allows us to
test and manipulate character data.
//There are different ways to build and format strings in C#: concatenation, numeric
format strings, or string interpolation.
//Note : The string keyword is an alias for the System.String class.
//from string literal and string concatenation
Console.WriteLine("------------String---------------------------");
string fname, lname;
fname = "Syed";
2. lname = "Khaleel";
string fullname = fname + lname;
Console.WriteLine("Full Name: {0}", fullname);
//by using string constructor
char[] letters = { 'H', 'e', 'l', 'l', 'o' };
string greetings = new string(letters);
Console.WriteLine("Greetings: {0}", greetings);
//methods returning string
string[] sarray = { "Hello", "From", "Tutorials", "Point" };
string message = String.Join(" ", sarray);
Console.WriteLine("Message: {0}", message);
//formatting method to convert a value
DateTime waiting = new DateTime(2012, 10, 10, 17, 58, 1);
string chat = String.Format("Message sent at {0:t} on {0:D}", waiting);
Console.WriteLine("Message: {0}", chat);
//TODO: Nullable type
//Defination: C# provides a special data types, the nullable types,
//to which you can assign normal range of values as well as null values.
Console.WriteLine("------------Nullable Type----------------------");
int? num1 = null;
int? num2 = 45;
double? num3 = new double?();
double? num4 = 3.14157;
bool? boolval = new bool?();
// display the values
Console.WriteLine("Nullables at Show: {0}, {1}, {2}, {3}", num1, num2, num3, num4);
Console.WriteLine("A Nullable boolean value: {0}", boolval);
//TODO: Implementing enum data type
//Defination: An enumeration is a set of named integer constants. An enumerated
type is declared using the enum keyword.
//C# enumerations are value data type. In other words, enumeration contains its own
values and cannot inherit or cannot pass inheritance.
Console.WriteLine("--------------------Enum type------------------------------");
int WeekdayStart = (int)Days.Mon;
int WeekdayEnd = (int)Days.Fri;
Console.WriteLine("Monday: {0}", WeekdayStart);
Console.WriteLine("Friday: {0}", WeekdayEnd);
3. //TODO: Regular Expression
//Defination: A regular expression is a pattern that could be matched against an
input text.
//The .Net framework provides a regular expression engine that allows such
matching.
//A pattern consists of one or more character literals, operators, or constructs.
Console.WriteLine("---------------------Regulare Expression----------------------------");
string str = "A Thousand Splendid Suns";
Console.WriteLine("Matching words that start with 'S': ");
showMatch(str, @"bSS*");
str = "make maze and manage to measure it";
Console.WriteLine("Matching words start with 'm' and ends with 'e':");
showMatch(str, @"bmS*eb");
//TODO: Remove Duplicate characters from a string
Console.WriteLine("Removing Duplicates from a string");
Console.WriteLine( RemoveDuplicates("abcddeeffgghii"));
//TODO: Extension method
//Defination: extension method is a static method of a static class that can be
invoked using the instance method syntax.
//Extension methods are used to add new behaviors to an existing type without
altering.
//In extension method "this" keyword is used with the first parameter and the type of
the first
//parameter will be the type that is extended by extension method.
Console.WriteLine("---------------------------------Extension Method----------------------------
-------");
string _s = "Dot Net Extension Method Example";
//calling extension method
int _i = _s.WordCount();
Console.WriteLine(_i);
//TODO: Implementing Simple If condition
//Defination: If statement consists of Boolean expression followed by single or
multiple statements to execute.
//An if statement allows you to take different paths of logic, depending on a given
condition.
//When the condition evaluates to a boolean true, a block of code for that true
condition will execute.
//You have the option of a single if statement, multiple else if statements, and an
optional else statement.
Console.WriteLine("---------------------------------- If Condition-----------------------------------
---");
int age = 20;
4. string Name = "Syed Khaleel";
if (age < 18)
{
Console.WriteLine("{0} is Minor", Name);
}
else
{
Console.WriteLine("{0} is Major", Name);
}
//TODO :Implementing for loop.
//Defination: A for loop is a repetition control structure that allows you to efficiently
write a loop
//that needs to execute a specific number of times.
Console.WriteLine("-------------For Loop----------------");
for (int i = 1; i <= 10; i++)
{
Console.Write(i + " ");
}
Console.WriteLine();
//TODO :While loop
//Defination: It repeats a statement or a group of statements while a given condition
is true.
//It tests the condition before executing the loop body.
Console.WriteLine("-------------While Loop-------------");
int j = 1;
while (j <= 10)
{
Console.Write(j + " ");
j++;
}
Console.WriteLine();
//TODO : Do while
//Defination: It is similar to a while statement, except that it tests the condition at the
end of the loop body
Console.WriteLine("----------------Do While----------------");
int x = 1;
do
{
Console.Write(x + " ");
x++;
} while (x <= 10);
Console.WriteLine();
//TODO : Foreach
//loops through the collection of items or objects
5. Console.WriteLine("--------------Foreach----------------");
string[] arr = { "sd", "md", "kd" };
foreach (var item in arr)
{
Console.Write(item + " ");
}
Console.WriteLine();
//TODO: Implementing Loop Control Statement with break.
//Defination: Terminates the loop or switch statement and transfers execution
//to the statement immediately following the loop or switch.
/* local variable definition */
int a = 1;
/* while loop execution */
while (a < 15)
{
Console.WriteLine("value of a: {0}", a);
a++;
if (a > 10)
{
/* terminate the loop using break statement */
break;
}
}
//TODO: Implementing Loop Contorl Statemnet with Continue.
//Defination: Causes the loop to skip the remainder of its body and immediately
//retest its condition prior to reiterating.
//Note*:The continue statement in C# works somewhat like the break statement.
//Instead of forcing termination, however, continue forces the next iteration of the
loop to take place, skipping any code in between.
Console.WriteLine("--------------------Loop Control Statement---------------------------------
");
/* local variable definition */
int value = 10;
/* do loop execution */
do
{
if (value == 15)
{
/* skip the iteration */
value = value + 1;
continue;
}
Console.WriteLine("value of a: {0}", value);
value++;
6. }
while (value < 20);
//TODO : switch
//Defination: A switch statement allows a variable to be tested for equality against a
list of values.
//Each value is called a case, and the variable being switched on is checked for each
switch case.
var color = "Red";
Console.WriteLine("----------------Swith Case----------------");
switch (color)
{
case "Red":
Console.WriteLine("Color in Color is " + color);
break;
case "Pink":
Console.WriteLine("Color in Color is " + color);
break;
case "Yellow":
Console.WriteLine("Color in Color is " + color);
break;
default:
break;
}
//TODO: single dimensional array
//Defination: An array stores a fixed-size sequential collection of elements of the
same type.
//An array is used to store a collection of data, but it is often more useful to think of
an array as a collection of variables of the same type
//stored at contiguous memory locations.
int n = int.Parse("855");
int d = 0;
string res = "";
string[] ones = new string[] { "One", "Two", "Three", "Four", "Five", "Six", "Seven",
"Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen",
"Seventeen", "Eighteen", "Nineteen" };
string[] tens = new string[] { "Ten", "Twenty", "Thirty", "Fourty", "Fifty", "Sixty",
"Seventy", "Eighty", "Ninty" };
Console.WriteLine("------------Singe Dimensional Array-----------------");
if (n > 99 && n < 1000)
{
d = n / 100;
res = ones[d - 1] + "Hundred";
n = n % 100;
}
7. if (n > 19 && n < 100)
{
d = n / 10;
res = res + tens[d - 1];
n = n % 10;
}
if (n > 0 && n < 10)
{
res = res + ones[n - 1];
}
Console.WriteLine(res);
Console.WriteLine("--------------Multi Dimensional Array---------------------");
//TODO : multi dimensional array
//Defination: stores data in rows and columns
string s = "";
int[,] xx = new int[,]
{
{7,8,9,0}, {1,2,3,4}, {9,9,9,9}
};
for (int r = 0; r < xx.GetLength(0); r++)
{
for (int c = 0; c < xx.GetLength(1); c++)
{
s = s + xx[r, c] + " ";
}
Console.WriteLine(s + " ");
s = "";
}
Console.WriteLine("--------------------Jagged Array--------------------");
//TODO : jagged array
//Defination: Its an array of array of differenct sizes
int[][] xxx = new int[3][];
xxx[0] = new int[] { 1, 2, 3, };
xxx[1] = new int[] { 10, 20, 30 };
xxx[2] = new int[] { 1, 2, 3, };
string sss = "";
for (int r = 0; r < xxx.GetLength(0); r++)
{
for (int c = 0; c < xxx.GetLength(0); c++)
{
sss = sss + xxx[r][c] + " ";
}
sss = sss + "n";
}
Console.Write(sss);
8. //TODO: Collections using ArrayList
//Defination: It represents an ordered collection of an object that can be indexed
individually.
//It is basically an alternative to an array. However, unlike array you can add and
remove items
//from a list at a specified position using an index and the array resizes itself
automatically.
//It also allows dynamic memory allocation, adding, searching and sorting items in
the list.
ArrayList al = new ArrayList();
Console.WriteLine("Adding some numbers:");
al.Add(45);
al.Add(78);
al.Add(33);
al.Add(56);
al.Add(12);
al.Add(23);
al.Add(9);
Console.WriteLine("Capacity: {0} ", al.Capacity);
Console.WriteLine("Count: {0}", al.Count);
Console.Write("Content: ");
foreach (int i in al)
{
Console.Write(i + " ");
}
Console.WriteLine();
Console.Write("Sorted Content: ");
al.Sort();
foreach (int i in al)
{
Console.Write(i + " ");
}
Console.WriteLine();
//TODO: Generics
//Defincation:Generics allow you to delay the specification of the data type of
programming elements in a class or a method,
//until it is actually used in the program. In other words, generics allow you to write a
class or method that can work with any data type.
//declaring an int array
MyGenericArray<int> intArray = new MyGenericArray<int>(5);
//setting values
for (int c = 0; c < 5; c++)
{
intArray.setItem(c, c * 5);
}
//retrieving the values
9. for (int c = 0; c < 5; c++)
{
Console.Write(intArray.getItem(c) + " ");
}
Console.WriteLine();
//declaring a character array
MyGenericArray<char> charArray = new MyGenericArray<char>(5);
//setting values
for (int c = 0; c < 5; c++)
{
charArray.setItem(c, (char)(c + 97));
}
//retrieving the values
for (int c = 0; c < 5; c++)
{
Console.Write(charArray.getItem(c) + " ");
}
Console.WriteLine();
//TODO: Constructor
//Defination: A constructor is a method of the class,
//i.e. meant for initializing the data members. The constructor gets called
automatically, whenever the object is declared.
Sample obj1 = new Sample(new Sample()
{
EmpId = 51581,
ENmae = "Syed Khaleel",
EAdress = "Hyd",
EAge = 29
});
obj1.displayEmpData();
//calling paramterized consturctor
ClsEmployee5 obj11 = new ClsEmployee5(121, "Syed Khaleel", "Hyd", 22);
obj11.DisplayEmpdata();
//TODO: calling constructor overloading
ClsConstrutorOverloading obj111 = new ClsConstrutorOverloading(101, "Syed
Khaleel", "Hyd", 24);
ClsConstrutorOverloading obj2 = new ClsConstrutorOverloading(102, "Anand");
obj111.DisplayEmpData();
obj2.DisplayEmpData();
//TODO:calculate salary
ClsSalary objsal = new ClsSalary();
objsal.GetSalData();
10. objsal.Calculate();
objsal.DisplaySqldata();
//TODO: user defined defualt constructor
UserDefinedDefualtConstructor UserDefinedDefualtConstructor = new
UserDefinedDefualtConstructor();
UserDefinedDefualtConstructor.DisplayEmpData();
//TODO : Invoking class inherited from Abstract class.
Square square = new Square();
Console.WriteLine("--------------------Abstract Class--------------------");
Console.WriteLine(square.Area());
//TODO: Multiple Inheritence
Console.WriteLine("--------------------------Multiple Inheritence with Interface---------------
----");
Manager manager = new Manager();
manager.GetBData();
manager.GetEmpData();
manager.DisplayBData();
manager.DisplayEmpData();
//TODO: Implementing Interface
//Defination: An interface is defined as a syntactical contract that all the classes
inheriting the interface should follow.
//The interface defines the 'what' part of the syntactical contract and the deriving
classes define the 'how' part of the syntactical contract.
//consists of only abstract memebers,by defualt members are public.
Console.WriteLine("--------------------------------Interface Example--------------------------");
I1 I = new C3();
I.F1();
I2 I2 = new C3();
I2.F1();
C3 c3 = new C3();
c3.F1();
//TODO: Properties
//Defination: Properties are named members of classes, structures, and interfaces.
Member variables or methods in a class or structures are called Fields.
//Properties are an extension of fields and are accessed using the same syntax. They
use accessors through which the values of the private fields can be read, written or
manipulated
Console.WriteLine("-------------------------------Properties ----------------------------------");
Property_Employee Property_Employee = new Property_Employee();
Console.Write("Enter Employee Details Id,Name,Address,Age");
Property_Employee.PEmpId = Convert.ToInt32(Console.ReadLine());
Property_Employee.PEName = Console.ReadLine();
Property_Employee.PEAddress = Console.ReadLine();
11. Property_Employee.PEAge = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(" Employee Id is " + Property_Employee.PEmpId);
Console.WriteLine(" Employee Name is " + Property_Employee.PEName);
Console.WriteLine(" Employee Address is " + Property_Employee.PEAddress);
Console.WriteLine(" Employee Age is " + Property_Employee.PEAge);
//TODO : Implementing Arrays
Console.WriteLine("----------------------------Reading Names from String Array ------------
--------");
string[] A = new string[6] { "Syed", "Raheem", "Anand", "Bela", "Pravesh", "Krishna" };
Console.WriteLine("ELEMENT of ARRAY array");
for (int i = 0; i < 6; i++)
{
Console.WriteLine(A[i] + "");
}
//TODO: Sealed Class
//Defination: a sealed class is a class which cannot be derived from other class.
Console.WriteLine("------------------------Sealed Class--------------------");
clsmanager obj = new clsmanager();
obj.GetEmpdata();
obj.DisplayEmpData();
//TODO: Partial Class Implemention
//Defination:a class can be divided into multiple classes using partial keyword.
Console.WriteLine("-------------------Partial Class------------------------------");
PartialClsEmployee PartialClsEmployee = new PartialClsEmployee();
PartialClsEmployee.Getempdata();
PartialClsEmployee.DisplayEmpdata();
//TODO: Delegate
Console.WriteLine("--------------------Delegate-----------------------------");
DelegateDemo delDemo = new DelegateDemo();
CSharpAndMe.Program.DelegateDemo.sayDel sd = new
CSharpAndMe.Program.DelegateDemo.sayDel(delDemo.sayHello);
Console.WriteLine(sd("xxx"));
CSharpAndMe.Program.DelegateDemo.addDel ad = new
CSharpAndMe.Program.DelegateDemo.addDel(delDemo.add);
ad(10, 20);
//TODO: Exceptional Handling
//Defination: An exception is a problem that arises during the execution of a program.
//A C# exception is a response to an exceptional circumstance that arises while a
program is running, such as an attempt to divide by zero.
Console.WriteLine("-----------------Exceptional Handling-------------------------");
ExceptionExample ExceptionExample = new ExceptionExample();
12. ExceptionExample.divide();
//TODO: Implementing Structures
//Defination: In C#, a structure is a value type data type. It helps you to make a single
variable hold related data of various data types.
//The struct keyword is used for creating a structure.
Console.WriteLine("------------------- Structures ----------------------------------");
MyStruct m1; // invokes default constructor
m1.x = 100; m1.show();
Console.WriteLine(m1.x);
MyStruct m2 = new MyStruct(200);
m2.show();
Console.WriteLine(m2.x);
//The acronym LINQ is for Language Integrated Query. Microsoft’s query language is
fully integrated and offers easy data access from in-memory objects,
//databases, XML documents and many more. It is through a set of extensions, LINQ
ably integrate queries in C# and Visual Basic.
//TODO: Linq Example ,finding no of files with same file extension.
Console.WriteLine("------------------ Linq Example ---------------------------");
string[] arrfile = { "aaa.txt", "bbb.TXT", "xyz.abc.pdf", "aaaa.PDF", "abc.xml", "ccc.txt",
"zzz.txt" };
var egrp = arrfile.Select(file => Path.GetExtension(file).TrimStart('.').ToLower())
.GroupBy(item => item, (ext, extCnt) => new
{
Extension = ext,
Count = extCnt.Count(),
});
foreach (var v in egrp)
Console.WriteLine("{0} File(s) with {1} Extension ", v.Count, v.Extension);
//TODO: Linq, find the file size
Console.WriteLine("-------------------- Find file size using LINQ -----------------------");
string[] dirfiles = Directory.GetFiles("E:Docs");//change the location if
var avg = dirfiles.Select(file => new FileInfo(file).Length).Average();
avg = Math.Round(avg / 10, 1);
Console.WriteLine("The Average file size is {0} MB", avg);
//TODO: Generate Odd Numbers using LINQ
Console.WriteLine("-------------Linq to generate Odd Numbers in Parallel------------------
");
IEnumerable<int> oddNums = ((ParallelQuery<int>)ParallelEnumerable.Range(20,
2000))
.Where(m => m % 2 != 0).OrderBy(m => m).Select(i => i);
foreach (int m in oddNums)
{
13. Console.Write(m + " ");
}
//TODO: Linq using IEnumareble
Console.WriteLine("------------------------ IEnumareble using LINQ ------------------------");
var t = typeof(IEnumerable);
var typesIEnum = AppDomain.CurrentDomain.GetAssemblies().SelectMany(ii =>
ii.GetTypes()).Where(ii => t.IsAssignableFrom(ii));
var count = 0;
foreach (var types in typesIEnum)
{
Console.WriteLine(types.FullName);
count++;
if (count == 20)
break;
}
//TODO: Divide numbers in sequence using Linq and Enumarable
Console.WriteLine("-------------------- C# Program to Divide Sequence into Groups
using LINQ ------------------------------");
var seq = Enumerable.Range(100, 100).Select(ff => ff / 10f);
var grps = from ff in seq.Select((k, l) => new { k, Grp = l / 10 })
group ff.k by ff.Grp into y
select new { Min = y.Min(), Max = y.Max() };
foreach (var grp in grps)
Console.WriteLine("Min: " + grp.Min + " Max:" + grp.Max);
//TODO : get Student Details using linq
Program pg = new Program();
IEnumerable<Student> studentQuery1 =
from student in pg.students
where student.ID > 1
select student;
Console.WriteLine("Query : Select range_variable");
Console.WriteLine("Name : ID");
foreach (Student stud in studentQuery1)
{
Console.WriteLine(stud.ToString());
}
//TODO: get numbers above 500 using linq
int[] numbers = {
500, 344, 221,
4443, 229, 1008,
6000, 767, 256, 10,501
};
var greaterNums = from num in numbers where num > 500 select num;
14. Console.WriteLine("Numbers Greater than 500 :");
foreach (var gn in greaterNums)
{
Console.Write(gn.ToString() + " ");
}
//Object Initialization for Student class
List<Students> objStudent = new List<Students>{
new Students{ Name="Tom",Regno="R001",Marks=80},
new Students{ Name="Bob",Regno="R002",Marks=40},
new Students{ Name="jerry",Regno="R003",Marks=25},
new Students{ Name="Syed",Regno="R004",Marks=30},
new Students{ Name="Mob",Regno="R005",Marks=70},
};
var objresult = from stu in objStudent
let totalMarks = objStudent.Sum(mark => mark.Marks)
let avgMarks = totalMarks / 5
where avgMarks > stu.Marks
select stu;
foreach (var stu in objresult)
{
Console.WriteLine("Student: {0} {1}", stu.Name, stu.Regno);
}
//TODO: Binary to decimal conversion
int numm, binary_val, decimal_val = 0, base_val = 1, rem;
Console.Write("Enter a Binary Number(1s and 0s) : ");
numm = int.Parse(Console.ReadLine()); /* maximum five digits */
binary_val = numm;
while (numm > 0)
{
rem = numm % 10;
decimal_val = decimal_val + rem * base_val;
numm = numm / 10;
base_val = base_val * 2;
}
Console.Write("The Binary Number is : " + binary_val);
Console.Write("nIts Decimal Equivalent is : " + decimal_val);
//TODO: Implementing Threading, simple thread
Program prog = new Program();
Thread thread = new Thread(new ThreadStart(prog.WorkThreadFunction));
thread.Start();
Console.Read();
//TODO: Implementing thread pool
15. ThreadPoolDemo tpd = new ThreadPoolDemo();
for (int i = 0; i < 2; i++)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(tpd.task1));
ThreadPool.QueueUserWorkItem(new WaitCallback(tpd.task2));
}
//TODO: Implementing thread sleep
for (int i = 0; i < 5; i++)
{
Console.WriteLine("Sleep for 2 Seconds");
Thread.Sleep(2000);
}
for (int i = 0; i < 10; i++)
{
ThreadStart start = new ThreadStart(TEST);
new Thread(start).Start();
}
ThreadingClass th = new ThreadingClass();
Thread thread1 = new Thread(th.DoStuff);
thread1.Start();
Console.WriteLine("Press any key to exit!!!");
Console.ReadKey();
th.Stop();
thread1.Join();
//mathematical programs
//TODO: Generating Febonaci Series
Console.WriteLine("Febonaci Series");
int fi, _count, f1 = 0, f2 = 1, f3 = 0;
Console.Write("Enter the Limit : ");
_count = int.Parse(Console.ReadLine());
Console.WriteLine(f1);
Console.WriteLine(f2);
for (fi = 0; fi <= _count; fi++)
{
f3 = f1 + f2;
Console.WriteLine(f3);
f1 = f2;
f2 = f3;
}
//Factorial of given number
Console.WriteLine("Factorial of a Number");
int faci, number, fact;
Console.WriteLine("Enter the Number");
16. number = int.Parse(Console.ReadLine());
fact = number;
for (faci = number - 1; faci >= 1; faci--)
{
fact = fact * faci;
}
Console.WriteLine("nFactorial of Given Number is: " + fact);
//Armstrong Number
//TODO: Finding Armstrong Number
Console.WriteLine("Armstrong Number");
int numberr, remainder, sum = 0;
Console.Write("enter the Number");
numberr = int.Parse(Console.ReadLine());
for (int i = numberr; i > 0; i = i / 10)
{
remainder = i % 10;
sum = sum + remainder * remainder * remainder;
}
if (sum == numberr)
{
Console.Write("Entered Number is an Armstrong Number");
}
else
Console.Write("Entered Number is not an Armstrong Number");
//Perfect Number
//TODO: Perfect Number Example
Console.WriteLine("Perfect Number");
int numberrr, summ = 0, nn;
Console.Write("enter the Number");
numberrr = int.Parse(Console.ReadLine());
nn = numberrr;
for (int i = 1; i < numberrr; i++)
{
if (numberrr % i == 0)
{
summ = summ + i;
}
}
if (summ == nn)
{
Console.WriteLine("n Entered number is a perfect number");
Console.ReadLine();
}
else
17. {
Console.WriteLine("n Entered number is not a perfect number");
Console.ReadLine();
}
//Palindrom
//TODO: to find the palindrome of a number
Console.WriteLine("Palindrome of a given number");
int _num, temp, remainderr, reverse = 0;
Console.WriteLine("Enter an integer n");
_num = int.Parse(Console.ReadLine());
temp = _num;
while (_num > 0)
{
remainderr = _num % 10;
reverse = reverse * 10 + remainderr;
_num /= 10;
}
Console.WriteLine("Given number is = {0}", temp);
Console.WriteLine("Its reverse is = {0}", reverse);
if (temp == reverse)
Console.WriteLine("Number is a palindrome n");
else
Console.WriteLine("Number is not a palindrome n");
//TODO: finding Distance using time and speed
Console.WriteLine("Distance Travelled in Time and speed");
int speed, distance, time;
Console.WriteLine("Enter the Speed(km/hr) : ");
speed = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter the Time(hrs) : ");
time = Convert.ToInt32(Console.ReadLine());
distance = speed * time;
Console.WriteLine("Distance Travelled (kms) : " + distance);
Console.WriteLine("Prime Number");
Console.Write("Enter a Number : ");
int nummm;
nummm = Convert.ToInt32(Console.ReadLine());
int _k;
_k = 0;
for (int i = 1; i <= nummm; i++)
{
if (nummm % i == 0)
{
_k++;
}
18. }
if (_k == 2)
{
Console.WriteLine("Entered Number is a Prime Number and the Largest Factor is
{0}", nummm);
}
else
{
Console.WriteLine("Not a Prime Number");
}
abbrevation _abrevation = new abbrevation();
_abrevation.readdata();
_abrevation.abbre();
//Reverse of a string
string Str, reversestring = "";
int Length;
Console.Write("Enter A String : ");
Str = Console.ReadLine();
Length = Str.Length - 1;
while (Length >= 0)
{
reversestring = reversestring + Str[Length];
Length--;
}
Console.WriteLine("Reverse String Is {0}", reversestring);
//TODO: Create a File
//Defination: A file is a collection of data stored in a disk with a specific name and a
directory path.
//When a file is opened for reading or writing, it becomes a stream.
//The stream is basically the sequence of bytes passing through the communication
path.
//There are two main streams: the input stream and the output stream.
//The input stream is used for reading data from file (read operation) and the output
stream is used for writing into the file (write operation).
string textpath = @"E:Docstest.txt";
using (FileStream fs = File.Create(textpath))
{
Byte[] info = new UTF8Encoding(true).GetBytes("File is Created");
fs.Write(info, 0, info.Length);
}
using (StreamReader sr = File.OpenText(textpath))
{
string sentence = "";
while ((sentence = sr.ReadLine()) != null)
19. {
Console.WriteLine(sentence);
}
}
FileRead fr = new FileRead();
fr.readdata();
Console.ReadKey();
}
private static void showMatch(string text, string expr)
{
Console.WriteLine("The Expression: " + expr);
MatchCollection mc = Regex.Matches(text, expr);
foreach (Match m in mc)
{
Console.WriteLine(m);
}
}
public static string RemoveDuplicates(string input)
{
return new string(input.ToCharArray().Distinct().ToArray());
}
//TODO : copy constructor
class Sample
{
public int EmpId, EAge;
public string ENmae, EAdress;
public Sample()
{
//Console.WriteLine("------------Enter Employee Details
EmployeeId,Name,Address,Age---------------------");
//EmpId = Convert.ToInt32(Console.ReadLine());
//ENmae = Console.ReadLine();
//EAdress = Console.ReadLine();
//EAge = Convert.ToInt32(Console.ReadLine());
}
public Sample(Sample objTemp)
{
EmpId = objTemp.EmpId;
ENmae = objTemp.ENmae;
EAdress = objTemp.EAdress;
EAge = objTemp.EAge;
}
20. public void displayEmpData()
{
Console.WriteLine("-------------------------Parameterized Constructor Passing an
Object-------------------------");
Console.WriteLine("Employee Id is " + EmpId);
Console.WriteLine("Employee ENmae is " + ENmae);
Console.WriteLine("Employee Adress is " + EAdress);
Console.WriteLine("Employee Age is " + EAge);
}
}
//TODO: parameterized consturctor
class ClsEmployee5
{
int EmpId, EAge;
string ENmae, EAddress;
public ClsEmployee5(int Id, string S1, string S2, int Ag)
{
this.EmpId = Id;
this.ENmae = S1;
this.EAddress = S2;
this.EAge = Ag;
}
public void DisplayEmpdata()
{
Console.WriteLine("------------------------------Parameterized Constructor-----------------
-----------------------");
Console.WriteLine("Employee Id is " + EmpId);
Console.WriteLine("Employee Name is " + ENmae);
Console.WriteLine("Employee Address is " + EAddress);
Console.WriteLine("Employee Age is " + EAge);
}
}
//TODO: constructor overloading
class ClsConstrutorOverloading
{
int EmpId, EAge;
string EName, EAddress;
public ClsConstrutorOverloading()
{
EmpId = 101;
EName = "Syed";
EAddress = "Hyd";
EAge = 24;
}
public ClsConstrutorOverloading(int Id, string S1)
{
21. EmpId = Id;
EName = S1;
}
public ClsConstrutorOverloading(int Id, string S1, string S2, int Ag)
{
EmpId = Id;
EName = S1;
EAddress = S2;
EAge = Ag;
}
public void DisplayEmpData()
{
Console.WriteLine("---------------------------------- Constructor Overloading ---------------
-----------------------------------");
Console.WriteLine("Employee id is " + EmpId);
Console.WriteLine("Employee Name is " + EName);
Console.WriteLine("Employee Adress is " + EAddress);
Console.WriteLine("Employee Age is " + EAge);
}
}
class ClsSalary
{
int EmpId;
string Ename;
double basic, Da, Hra, Gross;
public void GetSalData()
{
Console.WriteLine("------------------ Salary --------------------------");
Console.Write("Enter Employee details Employee Id,Name,Basic");
this.EmpId = Convert.ToInt32(Console.ReadLine());
this.Ename = Console.ReadLine();
this.basic = Convert.ToDouble(Console.ReadLine());
}
public void Calculate()
{
this.Da = 0.4 * this.basic;
this.Hra = 0.3 * this.basic;
this.Gross = this.basic + this.Da + this.Hra;
}
public void DisplaySqldata()
{
Console.WriteLine("Employee Id is " + this.EmpId);
Console.WriteLine("Employee Nameis " + this.Ename);
Console.WriteLine("Employee basic is " + this.basic);
Console.WriteLine("Employee da is " + this.Da);
Console.WriteLine("Employee hra is " + this.Hra);
Console.WriteLine("Employee Gross is " + this.Gross);
22. }
}
//Userdefined default Constructor
class UserDefinedDefualtConstructor
{
int EmpId, Age;
string EName, EAddress;
public UserDefinedDefualtConstructor()
{
this.EmpId = 101;
this.EName = "Syed Khaleel";
this.EAddress = "Hyd";
this.Age = 25;
}
public void DisplayEmpData()
{
Console.WriteLine("--------------------------User defined default Constructor--------------
---------------------------");
Console.WriteLine("EmpId is " + EmpId);
Console.WriteLine("Employee Name " + EName);
Console.WriteLine("Employee EADDRESS " + EAddress);
Console.WriteLine("Employee AGE " + Age);
}
}
// TODO : abstract class
//Defination: An Abstract class is an incomplete class or special class we can't
instantiate.
//We can use an Abstract class as a Base Class. An Abstract method must be
implemented in the non-Abstract class using the override keyword.
//After overriding the abstract method is in the non-Abstract class.
//We can derive this class in another class and again we can override the same
abstract method with it.
abstract class ShapesClass
{
abstract public int Area();
}
class Square : ShapesClass
{
int x = 10, y = 20;
// Not providing an Area method results
// in a compile-time error.
public override int Area()
{
return x * y;
}
}
23. class Branch
{
int Bcode;
string BName, BAddress;
public void GetBData()
{
Console.WriteLine("Enter Branch Details Code,Name,Address");
Bcode = Convert.ToInt32(Console.ReadLine());
BName = Console.ReadLine();
BAddress = Console.ReadLine();
}
public void DisplayBData()
{
Console.WriteLine(" Branch Code is " + Bcode);
Console.WriteLine(" Branch BName is " + BName);
Console.WriteLine(" Branch BAddress is " + BAddress);
}
}
interface Employee
{
void GetEmpData();
void DisplayEmpData();
}
class Manager : Branch, Employee
{
int EmpId;
string EName;
double Bonus, CA;
public void GetEmpData()
{
Console.WriteLine("Enter Manager Details Id,Name,Bonus,CA");
EmpId = Convert.ToInt32(Console.ReadLine());
EName = Console.ReadLine();
Bonus = Convert.ToDouble(Console.ReadLine());
CA = Convert.ToDouble(Console.ReadLine());
}
public void DisplayEmpData()
{
Console.WriteLine("Manager id is " + EmpId);
Console.WriteLine("Manager Name is " + EName);
Console.WriteLine("Manager Bonus is " + Bonus);
Console.WriteLine("Manager CA is " + CA);
}
}
interface I1
{
24. void F1();
}
interface I2
{
void F1();
}
class C3 : I1, I2
{
void I1.F1()
{
Console.WriteLine("Method f1 from I1");
}
void I2.F1()
{
Console.WriteLine("Method F2 from I2");
}
public void F1()
{
Console.WriteLine("F1 of C3");
}
}
//TODO : c# Properties example
//Definatio: On a class, a property gets and sets values. A simplified syntax form,
properties are implemented in the IL as methods.
//Properties are named members of classes, structures, and interfaces. Member
variables or methods in a class or structures are called Fields.
//Properties are an extension of fields and are accessed using the same syntax. They
use accessors through which the values of the private fields can be read,
//written or manipulated
class Property_Employee
{
int EmpId, EAge;
string EName, EAddress;
public int PEmpId
{
set { EmpId = value; }
get { return EmpId; }
}
public int PEAge
{
set { EAge = value; }
get { return EAge; }
}
25. public string PEName
{
set { EName = value; }
get { return EName; }
}
public string PEAddress
{
set { EAddress = value; }
get { return EAddress; }
}
}
//TODO: Sealed Class
class ClsEmployee
{
protected int Empid; int Eage;
protected string Ename; string Eaddress;
public virtual void GetEmpdata()
{
Console.Write("Enter Empliyee Details Id,Name,Address,Age:-");
this.Empid = Convert.ToInt32(Console.ReadLine());
this.Ename = Console.ReadLine();
this.Eaddress = Console.ReadLine();
this.Eage = Convert.ToInt32(Console.ReadLine());
}
public virtual void DisplayEmpData()
{
Console.WriteLine("Employee id is:-" + this.Empid);
Console.WriteLine("Employee id is:-" + this.Ename);
Console.WriteLine("Employee id is:-" + this.Eaddress);
Console.WriteLine("Employee id is:-" + this.Eage);
}
}
sealed class clsmanager : ClsEmployee
{
double bonus, ca;
public override void GetEmpdata()
{
Console.Write("Enter Empliyee Details Id,Name,Bonus,CA:-");
Empid = Convert.ToInt32(Console.ReadLine());
Ename = Console.ReadLine();
bonus = Convert.ToDouble(Console.ReadLine());
ca = Convert.ToDouble(Console.ReadLine());
}
public override void DisplayEmpData()
{
Console.WriteLine("Manager id is:-" + Empid);
26. Console.WriteLine("Manager name is:-" + Ename);
Console.WriteLine("Manager bonus is:-" + bonus);
Console.WriteLine("Manager ca is:-" + ca);
}
}
//TODO: Partial Class
partial class PartialClsEmployee
{
int empid, eage; string ename, eaddress;
public void Getempdata()
{
Console.WriteLine("Enter Employee details Id,Name,Address,Age");
this.empid = Convert.ToInt32(Console.ReadLine());
this.ename = Console.ReadLine();
this.eaddress = Console.ReadLine();
this.eage = Convert.ToInt32(Console.ReadLine());
}
}
partial class PartialClsEmployee
{
public void DisplayEmpdata()
{
Console.WriteLine("Employee id is:-" + empid);
Console.WriteLine("Employee name is:-" + ename);
Console.WriteLine("Employee address is:-" + eaddress);
Console.WriteLine("Employee id is:-" + eage);
}
}
//TODO: Exception Handling
//Defination: An exception is a problem that arises during the execution of a program.
//A C# exception is a response to an exceptional circumstance that arises while a
program is running, such as an attempt to divide by zero.
public class ExceptionExample
{
int x, y, z;
public void divide()
{
try
{
Console.WriteLine("enter x value : ");
x = int.Parse(Console.ReadLine());
Console.WriteLine("enter y value : ");
y = int.Parse(Console.ReadLine());
27. z = x / y;
Console.WriteLine(z);
}
catch (DivideByZeroException ex1)
{
Console.WriteLine("Divider should not be zero");
}
catch (FormatException ex2)
{
Console.WriteLine("u r entered wrong format");
}
catch (Exception e)
{
Console.WriteLine("error occured");
}
Console.WriteLine("end of the program");
Console.ReadLine();
}
}
//TODO:Delegates
//Defination: C# delegates are similar to pointers to functions, in C or C++.
//A delegate is a reference type variable that holds the reference to a method. The
reference can be changed at runtime.
//Delegates are especially used for implementing events and the call-back methods.
//All delegates are implicitly derived from the System.Delegate class.
class DelegateDemo
{
public delegate string sayDel(string name);
public delegate void addDel(int x, int y);
public string sayHello(string name)
{
return "Hello" + name;
}
public void add(int x, int y)
{
Console.WriteLine(x + y);
}
}
//TODO: Structures
//Defination: In C#, a structure is a value type data type. It helps you to make a single
variable hold related data of various data types.
//The struct keyword is used for creating a structure.
struct MyStruct
{
28. public int x;
public MyStruct(int x)
{
this.x = x;
}
public void show()
{
Console.WriteLine("Method in structure : " + x);
}
}
// TODO : to get Student Details using LINQ...
public class Student
{
public string First { get; set; }
public string Last { get; set; }
public int ID { get; set; }
public List<int> Marks;
public ContactInfo GetContactInfo(Program pg, int id)
{
ContactInfo allinfo =
(from ci in pg.contactList
where ci.ID == id
select ci)
.FirstOrDefault();
return allinfo;
}
public override string ToString()
{
return First + "" + Last + " : " + ID;
}
}
public class ContactInfo
{
public int ID { get; set; }
public string Email { get; set; }
public string Phone { get; set; }
public override string ToString() { return Email + "," + Phone; }
}
public class ScoreInfo
{
public double Average { get; set; }
29. public int ID { get; set; }
}
List<Student> students = new List<Student>()
{
new Student {First="Tom", Last=".S", ID=1, Marks= new List<int>() {97, 92, 81, 60}},
new Student {First="Jerry", Last=".M", ID=2, Marks= new List<int>() {75, 84, 91,
39}},
new Student {First="Bob", Last=".P", ID=3, Marks= new List<int>() {88, 94, 65, 91}},
new Student {First="Mark", Last=".G", ID=4, Marks= new List<int>() {97, 89, 85,
82}},
};
List<ContactInfo> contactList = new List<ContactInfo>()
{
new ContactInfo {ID=111, Email="[email protected]", Phone="9328298765"},
new ContactInfo {ID=112, Email="[email protected]", Phone="9876543201"},
new ContactInfo {ID=113, Email="[email protected]", Phone="9087467653"},
new ContactInfo {ID=114, Email="[email protected]", Phone="9870098761"}
};
class Students
{
public string Name { get; set; }
public string Regno { get; set; }
public int Marks { get; set; }
}
class ThreadPoolDemo
{
public void task1(object obj)
{
for (int i = 0; i <= 2; i++)
{
Console.WriteLine("Task 1 is being executed");
}
}
public void task2(object obj)
{
for (int i = 0; i <= 2; i++)
{
Console.WriteLine("Task 2 is being executed");
}
}
}
static readonly object _object = new object();
static void TEST()
{
lock (_object)
{
Thread.Sleep(100);
Console.WriteLine(Environment.TickCount);
30. }
}
public class ThreadingClass
{
private bool flag = false;
private int count = 0;
public void DoStuff()
{
while (!flag)
{
Console.WriteLine(" Thread is Still Working");
Thread.Sleep(1000);
count++;
if (count == 20)
break;
}
}
public void Stop()
{
flag = true;
}
}
public class abbrevation
{
string str;
public void readdata()
{
Console.WriteLine("Enter a String :");
str = Console.In.ReadLine();
}
public void abbre()
{
char[] c, result;
int j = 0;
c = new char[str.Length];
result = new char[str.Length];
c = str.ToCharArray();
result[j++] = (char)((int)c[0] ^ 32);
result[j++] = '.';
for (int i = 0; i < str.Length - 1; i++)
{
if (c[i] == ' ' || c[i] == 't' || c[i] == 'n')
{
int k = (int)c[i + 1] ^ 32;
result[j++] = (char)k;
result[j++] = '.';
}
31. }
Console.Write("The Abbreviation for {0} is ", str);
Console.WriteLine(result);
Console.ReadLine();
}
}
class FileRead
{
public void readdata()
{
FileStream fs = new FileStream(@"E:Docstest.txt", FileMode.Open,
FileAccess.Read);
StreamReader sr = new StreamReader(fs);//Position the File Pointer at the
Beginning of the File
sr.BaseStream.Seek(0, SeekOrigin.Begin);//Read till the End of the File is
Encountered
string str = sr.ReadLine();
while (str != null)
{
Console.WriteLine("{0}", str);
str = sr.ReadLine();
}
//Close the Writer and File
sr.Close();
fs.Close();
}
}
public void WorkThreadFunction()
{
for (int i = 0; i < 5; i++)
{
Console.WriteLine("Simple Thread");
}
}
public class MyGenericArray<T>
{
private T[] array;
public MyGenericArray(int size)
{
array = new T[size + 1];
}
public T getItem(int index)
{
return array[index];
}
32. public void setItem(int index, T value)
{
array[index] = value;
}
}
}
public class Base
{
public virtual void print()
{
Console.Write("df");
}
public void display()
{ Console.Write("df2"); }
}
public class Derived:Base
{
public new void display()
{ Console.Write("df3"); }
public override void print()
{
Console.Write("df1");
}
}
public static class MyExtensions
{
public static int WordCount(this String str)
{
return str.Split(new char[] { ' ', '.', ',' }).Length;
}
}
}