The document discusses defining and using methods in Java. It defines what a method is and its key components like the method signature, return type, parameters, and body. It then demonstrates a sample max method to return the maximum of two numbers and traces the steps of invoking the method from the main method, including passing arguments, executing the method body, and returning the result. The document aims to explain the basics of methods in Java, including how to define reusable methods and invoke them to perform certain tasks.
This document discusses different types of functions in C programming. It defines library functions, user-defined functions, and the key elements of functions like prototypes, arguments, parameters, return values. It categorizes functions based on whether they have arguments and return values. The document also explains how functions are called, either by value where changes are not reflected back or by reference where the original values are changed.
A string is a data type used in programming, such as an integer and floating point unit, but is used to represent text rather than numbers. It is comprised of a set of characters that can also contain spaces and numbers. For example, the word "hamburger" and the phrase "I ate 3 hamburgers" are both strings.
The document discusses functions in C programming. It defines a function as a self-contained block of code that performs a specific task. Functions make code more modular and reusable. There are two types of functions: standard/library functions and user-defined functions. Functions can take input parameters and return values. Functions are an essential part of program structure in C as they help organize code and logic.
The document discusses Python data types. It describes the numeric data types integer, float, and complex which are used to represent numbers. Integer is a whole number without decimals, float has decimals, and complex numbers have real and imaginary parts. None is described as a null value. Strings are arrays of characters and can be indexed. Tuples and lists are ordered collections that can hold heterogeneous data types. Sets are unordered collections of unique items. Dictionaries are unordered collections of key-value pairs that allow accessing values via keys.
This document discusses strings and string buffers in Java. It defines strings as sequences of characters that are class objects implemented using the String and StringBuffer classes. It provides examples of declaring, initializing, concatenating and using various methods like length(), charAt() etc. on strings. The document also introduces the StringBuffer class for mutable strings and lists some common StringBuffer functions.
This document discusses nested classes in Java. It defines nested classes as classes defined within other classes. There are two main types - non-static nested classes and static nested classes. Non-static nested classes can access private members of the outer class and require an outer class instance, while static nested classes behave like regular classes and do not require an outer class instance. The document covers the different types of non-static nested classes and provides examples to illustrate their usage and properties. It also compares static and non-static nested classes and discusses the advantages and disadvantages of using nested classes.
This document discusses input and output in C++. It explains that C++ uses stream classes to implement input/output operations with the console and disk files. It describes the different stream classes like istream, ostream, and iostream. It discusses unformatted I/O functions like cin, cout, get(), put(), getline(), and write() for console input/output. It also covers formatted I/O functions like width(), precision(), fill(), and setf() to control formatting of output.
The document discusses exception handling in Java. It defines exceptions as runtime errors that occur during program execution. It describes different types of exceptions like checked exceptions and unchecked exceptions. It explains how to use try, catch, throw, throws and finally keywords to handle exceptions. The try block contains code that might throw exceptions. The catch block catches and handles specific exceptions. The finally block contains cleanup code that always executes regardless of exceptions. The document provides examples of exception handling code in Java.
The document discusses constructors and destructors in C++. It describes constructor functions as special member functions that initialize object values when an object is created. It covers default constructors, parameterized constructors, copy constructors, and constructor overloading. Destructors are described as special functions that destroy objects and perform cleanup when objects go out of scope. The key characteristics and uses of constructors and destructors are summarized with examples.
The document discusses strings in C programming. It defines strings as sequences of characters stored as character arrays that are terminated with a null character. It covers string literals, declaring and initializing string variables, reading and writing strings, and common string manipulation functions like strlen(), strcpy(), strcmp(), and strcat(). These functions allow operations on strings like getting the length, copying strings, comparing strings, and concatenating strings.
This document discusses function overloading, inline functions, and friend functions in C++. It defines function overloading as having two or more functions with the same name but different parameters, allowing for compile-time polymorphism. Inline functions have their body inserted at call sites for faster execution. Friend functions are non-member functions that have access to private members of a class. Examples are provided to demonstrate overloaded functions, inline functions checking for prime numbers, and using a friend function to check if a number is even or odd. Important concepts and questions for discussion are also outlined.
Functions allow programmers to break programs into smaller, reusable parts. There are two types of functions in C: library functions and user-defined functions. User-defined functions make programs easier to understand, debug, test and maintain. Functions are declared with a return type and can accept arguments. Functions can call other functions, allowing for modular and structured program design.
The document provides an overview of the Python programming language. It discusses that Python is an easy to learn, high-level, open-source programming language. It describes Python's design philosophy of code readability and how it allows programmers to express concepts in fewer lines of code compared to languages like C++ and Java. The document also discusses Python's powerful libraries, wide use across industries, and how to get started with Python programming using the IDLE integrated development environment.
This document discusses methods, constructors, and interfaces in Java programming. It defines methods as constructs that group statements together to perform a function. Methods can return values or be void. Constructors are special methods used to initialize objects, and must have the same name as the class. Interfaces contain abstract method signatures that classes implement, allowing for multiple inheritance. The document provides examples of defining methods, constructors, abstract classes, and implementing interfaces in Java code.
The document discusses the static keyword in Java and its uses for variables, methods, blocks and nested classes. It explains that static members belong to the class rather than instances, and provides examples of static variables, methods, blocks and how they work. Key points include static variables having only one copy in memory and being shared across instances, static methods that can be called without an instance, and static blocks that initialize static fields when the class loads.
This document provides an overview of common string functions in C including strcmp(), strcat(), strcpy(), and strlen(). It defines each function, explains what it is used for, provides the syntax, and includes examples of how each string function works in C code. Overall, the document is a tutorial on the most common string manipulation functions available in the standard C string library.
Python functions allow for reusable code through defining functions, passing arguments, returning values, and setting scopes. Functions can take positional or keyword arguments, as well as variable length arguments. Default arguments allow functions to specify default values for optional parameters. Functions are objects that can be assigned to variables and referenced later.
The document discusses the File class in Java, which represents files and directories on disk without providing file processing capabilities. It describes the File class constructors and common methods like exists(), isFile(), isDirectory(), getPath(), and list(). Examples are provided to demonstrate analyzing a file or directory path specified by the user, including checking if it exists, retrieving information about it, and listing the contents if it is a directory. The document also notes some common errors like using \ instead of \\ in file paths in string literals.
The document discusses reading and writing text files in Java. It shows how to use the PrintWriter class to write data like names and scores to a text file. It then demonstrates using the Scanner class to read the data back from the file by parsing the strings and integers. The example writes two names and scores to a file, and then reads and prints out the same data.
The document discusses defining and using methods in Java. It defines what a method is and its key components like the method signature, return type, parameters, and body. It then demonstrates a sample max method to return the maximum of two numbers and traces the steps of invoking the method from the main method, including passing arguments, executing the method body, and returning the result. The document aims to explain the basics of methods in Java, including how to define reusable methods and invoke them to perform certain tasks.
1. Classes allow the creation of user-defined data types through the grouping of related data members and member functions.
2. Class members can be declared as private, public or protected and determine accessibility outside the class.
3. Methods are defined similarly to regular functions but can access any member of the class without passing them as parameters.
The document discusses arrays and motivates their use. It explains that arrays allow storing a large number of values in a program and accessing them through indices. Arrays solve the problem of having to declare many individual variables to store multiple values. The document then introduces the concept of arrays, how to declare and initialize array variables, and how to access elements within an array using indices. It provides examples of declaring, initializing, and accessing one-dimensional and two-dimensional arrays.
http://KOKUIS.my/html5
HTML5 – refers to the modern day of HTML which promotes native handling of video & audio & animation without having to install additional plugins to browser.
.
Bootstrap – A HTML framework supports responsive web design to provide one time webpage development for smartphone, tablet and desktop.
.
Mobirise – a free web design studio that support HTML5 & Bootstrap’s famous ‘block’ design.
This document discusses developing mobile web apps using HTML5, jQuery, and PhoneGap/Apache Cordova. It covers the hybrid approach of using HTML/CSS/JavaScript for the front-end and PhoneGap to package it as a native mobile app. Tools mentioned include Apache Cordova, Node.js, Eclipse, and Xcode. It provides an overview of key topics to be covered in subsequent days, such as the mobile web page structure using jQuery Mobile, connecting to online databases using PHP and MySQL, and building apps with PhoneGap Build.
This document provides an overview and introduction to developing Android apps using a hybrid approach with HTML5, jQuery, Apache Cordova and the Android SDK. It begins with background information about the author and their experience developing Android apps. It then outlines an agenda for two days of training on this topic. The rest of the document addresses frequently asked questions about Android and the hybrid app development process through short explanations and diagrams. Key topics covered include what Android is, its architecture, tools used for hybrid app development like Cordova and Eclipse, and how to structure an Android project.
This document discusses methods in Java programming. It defines methods as collections of statements grouped together to perform operations. Methods can take parameters and return values. When a method is invoked, an activation record is created on the call stack to store its parameters and variables. The document discusses defining methods, passing arguments, return values, and method overloading. It also provides examples of tracing method calls and return values on the call stack.
To define methods, invoke methods, and pass arguments to a method (§5.2-5.5).
To develop reusable code that is modular, easy-to-read, easy-to-debug, and easy-to-maintain. (§5.6).
To use method overloading and understand ambiguous overloading (§5.7).
To design and implement overloaded methods (§5.8).
To determine the scope of variables (§5.9).
To know how to use the methods in the Math class (§§5.10-5.11).
To learn the concept of method abstraction (§5.12).
To design and implement methods using stepwise refinement (§5.12).
This document discusses chapters and concepts from Liang's Introduction to Java Programming textbook. It covers defining and using methods in Java, including defining methods with parameters and return types, invoking methods by passing arguments, and how method calls are handled by the call stack. Key points covered include formal vs actual parameters, method signatures, return values, and reusing methods from other classes. Examples are provided to demonstrate calculating sums and finding maximum values using methods.
The document discusses Java methods. It defines a method as a collection of statements grouped to perform an operation. A method signature combines the method name and parameter list. Formal parameters are defined in the method header, while actual parameters are the values passed when invoking the method. The document provides an example method that returns the maximum of two integers.
This document discusses methods in Java. It defines methods as collections of statements grouped together to perform an operation. It covers defining methods, invoking methods, passing parameters, return values, scope of variables, overloading methods, and abstracting method implementation through black box abstraction. Examples are provided to demonstrate key concepts like defining methods with different parameter types, passing arguments by value, and generating random characters through a method. The document is from a chapter in an introductory Java programming textbook.
The document describes functions in Python. It defines what a function is, how to define and invoke functions, and how functions work. It discusses function headers, parameters, arguments, return values, and function bodies. Examples are provided to demonstrate defining a max() function to return the maximum of two numbers, and testing/invoking the function. The use of functions to organize code and enable reuse is discussed.
The document discusses functions and static variables in C++. It covers topics like:
- Creating functions, invoking functions, and passing arguments to functions.
- Determining the scope of local and global variables.
- Understanding the differences between pass-by-value and pass-by-reference.
- Using function overloading and dealing with ambiguous overloading.
- Using function prototypes for declaring function headers.
- Knowing how to use default arguments.
- Static variables.
This document contains solutions to questions from a computer science examination. It includes questions on topics like Python, Pandas, SQL, data visualization, and computer networks. The solutions demonstrate how to write Python code to create and manipulate dataframes, plot charts, and perform SQL queries. Examples of network topologies and devices like switches, modems, and gateways are also provided. The document aims to test students' understanding of key concepts in informatics practices.
From JVM to .NET languages, from minor coding idioms to system-level architectures, functional programming is enjoying a long overdue surge in interest. Functional programming is certainly not a new idea and, although not apparently as mainstream as object-oriented and procedural programming, many of its concepts are also more familiar than many programmers believe. This talk examines functional and declarative programming styles from the point of view of coding patterns, little languages and programming techniques already familiar to many programmers.
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.
The document describes a Java program to calculate parcel shipping charges based on weight. It begins with an initial charge of Rs. 15 for the first 1KG. Any additional weight is charged Rs. 8 for every 500g or fraction thereof. The program takes a weight in KGs as input, calculates the remaining weight after deducting 1KG, determines the charge for full 500g increments and any fractional part, and outputs the total charge.
The document contains 17 code snippets that demonstrate various Java programming concepts like loops, arrays, methods, classes, input/output, etc. Specifically, the code snippets show:
1. Using for loops to print numeric series
2. Accepting user input of different data types using Scanner and parsing
3. Using StringTokenizer and Scanner classes
4. Finding largest number among 3 inputs and printing tables
5. Demonstrating 2D arrays, array of objects, and command line arguments
6. Various String class methods like length(), substring(), indexOf() etc.
The document contains 21 programming problems involving Java concepts like arrays, loops, methods, classes, objects, constructors, and more. For each problem, source code is provided to demonstrate how to solve the problem, followed by sample output. Some key problems include: (1) printing series using nested loops, (2) receiving user input of different data types, (3) using StringTokenizer and Scanner classes, (4) finding largest of 3 numbers, (5) using 2D arrays and array of objects.
Kotlin Perfomance on Android / Александр Смирнов (Splyt)Ontico
РИТ++ 2017, AppsConf
Зал Касабланка, 6 июня, 14:00
Тезисы:
http://appsconf.ru/2017/abstracts/2816.html
В докладе рассмотрим цену использования Kotlin в Runtime, обсудим варианты, как улучшить картину мира. Смотреть будем с точки зрения производительности, синхронно углубляясь в особенности Android, а также подумаем, как можно использовать получившийся байткод.
В докладе срыв подкапотных оптимизаций, байткод и цифры, которые покажут, насколько сильно вам смогут помочь все указанные оптимизации.
The document discusses functions in C++ and provides examples of defining and calling functions. It explains that a function allows structuring programs in a modular way and accessing structured programming capabilities. A function is defined with a return type, name, parameters, and body. Parameters allow passing arguments when calling the function. The function examples demonstrate defining an addition function, calling it from main to add two numbers and return the result. It also covers function scope, with local variables only accessible within the function and global variables accessible anywhere.
This document discusses functions in C programming. It covers defining and declaring functions, variable scope, parameter passing, inline functions, recursive functions, function arguments, and function applications. It provides examples of function definitions and calls using integers, strings, and arrays. It explains call by value, call by address, and call by reference parameter passing. It also discusses global, private, and static variables and using the scope resolution operator.
The document contains the solutions to 64 programming problems in Java. It provides the code to write programs that can:
1) Display patterns like right angle triangles and pyramids with numbers.
2) Check if a number is negative, zero or positive.
3) Sort arrays and insert or find elements in arrays.
4) Perform operations like calculating averages and separating even/odd numbers in arrays.
3) Find pair sums and rotate/add matrices.
Methods are used to define reusable logic and are declared with access modifiers, a return type, name, and optional parameters. There are two types of methods: static methods associated with a class and instance methods associated with an object. Parameters can be passed by value, reference, or as out/ref parameters. Optional and named parameters allow flexibility in how arguments are passed to methods.
The document contains code snippets from 3 weekly coding assignments:
1) A Java program to check if a string is a palindrome. It compares characters at the beginning and end of the string.
2) A Java program to sort a list of names in ascending order using string comparison and swapping.
3) A Java program to count the frequency of words in a given text by tokenizing, sorting, and printing the words.
The document discusses methods in Java programming. It defines what a method is, including method signature, formal and actual parameters, return type, and calling methods. It provides examples of defining, invoking, and overloading methods. It also covers topics like pass by value, scope of local variables, and modularizing code with methods. The document is from a chapter about methods in an introduction to Java programming and data structures textbook.
Dokumen tersebut membahas sejarah perkembangan ilmu pengetahuan dan masyarakat, termasuk definisi ilmu pengetahuan, pengaruh ilmu pengetahuan dalam peradaban dunia, era digital dan perbedaan antara masyarakat bermaklumat dengan masyarakat berpengetahuan.
This document discusses Islam in the era of information and communication technology (ICT). It states that Islam's core belief is that Allah is the creator of all things, and that the purpose of creation is for humans to worship Allah and act as stewards of the earth. While ICT provides benefits, it also poses challenges like the spread of false information and exposure of youth to inappropriate content without oversight. The document argues that Islamic principles of maintaining balance, protecting faith, life, intellect and society, and eliminating harm can help address issues in the ICT era.
Application of Ontology in Semantic Information Retrieval by Prof Shahrul Azm...Khirulnizam Abd Rahman
Application of Ontology in Semantic Information Retrieval
by Prof Shahrul Azman from FSTM, UKM
Presentation for MyREN Seminar 2014
Berjaya Hotel, Kuala Lumpur
27 November 2014
This document provides information about a course on fundamentals of Java programming taught by Khirulnizam Abd Rahman. It includes details about the instructor's background and programming experience, course synopsis and objectives, assessment methods, required textbooks, and an outline of topics to be covered such as control structures, methods, arrays, classes, and file I/O. The topic outline lists lessons on selection structures including if-else statements and switch cases, as well as repetition structures and nested control flows.
This document provides information about a course on Java programming fundamentals taught by Khirulnizam Abd Rahman. It includes details about the lecturer's background and programming experience, the course synopsis and objectives, main textbooks, and topics that will be covered such as control structures, methods, arrays, classes, and file I/O. Sample code is provided to demonstrate if/else and switch statements, including nested if statements. An exercise at the end prompts students to write a program using nested if/else statements to assign grades based on scores.
This course is the continuation of the previous course (Algorithm and Problem Solving). It introduces complex flow control, method, array, class design, file and file I/O.
Kursus ini membincangkan adab pengendalian maklumat, isu-isu yang berkaitan dengan teknologi komputer dan teknologi maklumat. Penggunaan komputer peribadi dengan memberi pendedahan kepada perkakasan dan perisian komputer. Membincangkan mengenai internet, telekomunikasi serta pencarian maklumat melalui web. Membentuk pelajar yang beradab dalam pengendalian dan pengurusan maklumat.
This document provides guidance on writing a review paper in 3 sentences or less. It outlines the simple skeleton of a review paper including the title, affiliation, abstract, introduction, previous works, and conclusion sections. The document recommends reading sample papers and provides page by page guidance for completing each section of the paper within the 5 page limit. It emphasizes gaining experience by writing and encourages participants to draft their paper.
AIRS 2014 is the 10th annual Asia Information Retrieval Societies Conference that will be held in Kuching, Sarawak, Malaysia from December 3-5, 2014. The conference is hosted by the Malaysia Society of Information Retrieval and Knowledge Management and aims to bring together researchers to exchange ideas in the field of information retrieval, covering applications in text, audio, video and multimedia. Authors are invited to submit original papers by May 22, 2014 on topics related to information retrieval models, evaluation, web search, multimedia retrieval, natural language processing and machine learning.
With Android phones being produced by all of the major phone manufacturers and with the addition of new tablet devices, it's no surprise that the Android platform is the fastest growing mobile development platform in the world. In this course, you will learn to develop Android applications using Java and the Eclipse development environment. You will learn basic application development including using the Android mobile camera, working with local database, and playing audio and video files.
At the end of the course, participant should be able to;
• Use Eclipse and the Android ADT plugin to develop and debug Android applications
• Set up text input from the hardware or software keyboard
• Display scrolling lists and grids with custom layouts
• Listen and react to touch events
• Manipulating Audio
• Handling Video
• Developing Multimedia Apps
This document describes a mobile app that was developed to detect Malay proverbs in sentences using pattern matching. It discusses related works on multiword indexing and proverb dictionaries. The app uses a simple pattern matching algorithm to detect proverbs by searching word combinations in a proverb database. Challenges include dealing with affixes and stop words. Future work includes improving detection by adding stemming and stop word removal. The prototype aims to help learners of the Malay language and further study of syntactic rules is suggested.
Ayat-ayat al-Quran dan Doa-doa yang terdapat di dalam helaian ini adalah seperti yang terdapat di dalam applikasi m-mathurat. Kami juga menyertakan suara bacaan al-Ma’thurat di dalam applikasi mobil tersebut. Sila muat-turun dari:
http://bit.ly/mathurat
The document outlines an agenda and topics for an Android development 101 training session over two days. Day one will cover creating an Android project, widgets and interactions, and HTML/WebView. Day two will cover audio, video, signing APKs, and uploading to the Google Play store. The document also provides answers to frequently asked questions about Android topics like what Android is, its architecture, available versions, tools for development, and distributing apps. Demo portions are planned to accompany the topics.
Khirulnizam - students experience in using blog as a learning tool - world co...Khirulnizam Abd Rahman
Abstract
This paper is to report a study on the students’ experience in using blog (weblog) as a learning tool. For the purpose of this study, a blog was prepared for the subject of Web Programming. This blog is a place where the lecturer posts the syllabus, lecture notes, presentations slides, computer lab manual, assignments, discussions, code samples and also announcements. The students are required to visit the blog to download the learning materials and to participate in the discussions. It is a quantitative survey to find out whether the students having a good or bad experience in using the blog. The authors also would like to know the students’ experience in using the blog; in terms of flexibility, content presentation or arrangement, communication, experience through blog, update medium, navigation and overall experience.
Choose our Linux Web Hosting for a seamless and successful online presencerajancomputerfbd
Our Linux Web Hosting plans offer unbeatable performance, security, and scalability, ensuring your website runs smoothly and efficiently.
Visit- https://onliveserver.com/linux-web-hosting/
Details of description part II: Describing images in practice - Tech Forum 2024BookNet Canada
This presentation explores the practical application of image description techniques. Familiar guidelines will be demonstrated in practice, and descriptions will be developed “live”! If you have learned a lot about the theory of image description techniques but want to feel more confident putting them into practice, this is the presentation for you. There will be useful, actionable information for everyone, whether you are working with authors, colleagues, alone, or leveraging AI as a collaborator.
Link to presentation recording and transcript: https://bnctechforum.ca/sessions/details-of-description-part-ii-describing-images-in-practice/
Presented by BookNet Canada on June 25, 2024, with support from the Department of Canadian Heritage.
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptxSynapseIndia
Your comprehensive guide to RPA in healthcare for 2024. Explore the benefits, use cases, and emerging trends of robotic process automation. Understand the challenges and prepare for the future of healthcare automation
Kief Morris rethinks the infrastructure code delivery lifecycle, advocating for a shift towards composable infrastructure systems. We should shift to designing around deployable components rather than code modules, use more useful levels of abstraction, and drive design and deployment from applications rather than bottom-up, monolithic architecture and delivery.
An invited talk given by Mark Billinghurst on Research Directions for Cross Reality Interfaces. This was given on July 2nd 2024 as part of the 2024 Summer School on Cross Reality in Hagenberg, Austria (July 1st - 7th)
Measuring the Impact of Network Latency at TwitterScyllaDB
Widya Salim and Victor Ma will outline the causal impact analysis, framework, and key learnings used to quantify the impact of reducing Twitter's network latency.
INDIAN AIR FORCE FIGHTER PLANES LIST.pdfjackson110191
These fighter aircraft have uses outside of traditional combat situations. They are essential in defending India's territorial integrity, averting dangers, and delivering aid to those in need during natural calamities. Additionally, the IAF improves its interoperability and fortifies international military alliances by working together and conducting joint exercises with other air forces.
How Social Media Hackers Help You to See Your Wife's Message.pdfHackersList
In the modern digital era, social media platforms have become integral to our daily lives. These platforms, including Facebook, Instagram, WhatsApp, and Snapchat, offer countless ways to connect, share, and communicate.
7 Most Powerful Solar Storms in the History of Earth.pdfEnterprise Wired
Solar Storms (Geo Magnetic Storms) are the motion of accelerated charged particles in the solar environment with high velocities due to the coronal mass ejection (CME).
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Chris Swan
Have you noticed the OpenSSF Scorecard badges on the official Dart and Flutter repos? It's Google's way of showing that they care about security. Practices such as pinning dependencies, branch protection, required reviews, continuous integration tests etc. are measured to provide a score and accompanying badge.
You can do the same for your projects, and this presentation will show you how, with an emphasis on the unique challenges that come up when working with Dart and Flutter.
The session will provide a walkthrough of the steps involved in securing a first repository, and then what it takes to repeat that process across an organization with multiple repos. It will also look at the ongoing maintenance involved once scorecards have been implemented, and how aspects of that maintenance can be better automated to minimize toil.
Quantum Communications Q&A with Gemini LLM. These are based on Shannon's Noisy channel Theorem and offers how the classical theory applies to the quantum world.
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - MydbopsMydbops
This presentation, delivered at the Postgres Bangalore (PGBLR) Meetup-2 on June 29th, 2024, dives deep into connection pooling for PostgreSQL databases. Aakash M, a PostgreSQL Tech Lead at Mydbops, explores the challenges of managing numerous connections and explains how connection pooling optimizes performance and resource utilization.
Key Takeaways:
* Understand why connection pooling is essential for high-traffic applications
* Explore various connection poolers available for PostgreSQL, including pgbouncer
* Learn the configuration options and functionalities of pgbouncer
* Discover best practices for monitoring and troubleshooting connection pooling setups
* Gain insights into real-world use cases and considerations for production environments
This presentation is ideal for:
* Database administrators (DBAs)
* Developers working with PostgreSQL
* DevOps engineers
* Anyone interested in optimizing PostgreSQL performance
Contact info@mydbops.com for PostgreSQL Managed, Consulting and Remote DBA Services
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdfNeo4j
Presented at Gartner Data & Analytics, London Maty 2024. BT Group has used the Neo4j Graph Database to enable impressive digital transformation programs over the last 6 years. By re-imagining their operational support systems to adopt self-serve and data lead principles they have substantially reduced the number of applications and complexity of their operations. The result has been a substantial reduction in risk and costs while improving time to value, innovation, and process automation. Join this session to hear their story, the lessons they learned along the way and how their future innovation plans include the exploration of uses of EKG + Generative AI.
Sustainability requires ingenuity and stewardship. Did you know Pigging Solutions pigging systems help you achieve your sustainable manufacturing goals AND provide rapid return on investment.
How? Our systems recover over 99% of product in transfer piping. Recovering trapped product from transfer lines that would otherwise become flush-waste, means you can increase batch yields and eliminate flush waste. From raw materials to finished product, if you can pump it, we can pig it.
The DealBook is our annual overview of the Ukrainian tech investment industry. This edition comprehensively covers the full year 2023 and the first deals of 2024.
20240704 QFM023 Engineering Leadership Reading List June 2024
Chapter 2 Java Methods
1. 1Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Chapter 2 Methods
2. 2Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Motivations
A method is a construct for grouping statements together
to perform a function. Using a method, you can write the
code once for performing the function in a program and
reuse it by many other programs. For example, often you
need to find the maximum between two numbers.
Whenever you need this function, you would have to write
the following code:
int result;
if (num1 > num2)
result = num1;
else
result = num2;
If you define this function for finding a
maximum number between any two
numbers in a method, you don’t have to
repeatedly write the same code. You
need to define it just once and reuse it
by any other programs.
3. 3Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Objectives
To define methods, invoke methods, and pass arguments to a
method.
To develop reusable code that is modular, easy-to-read, easy-to-
debug, and easy-to-maintain.
To determine the scope of variables.
4. 4Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Defining Methods
A method is a collection of statements that are
grouped together to perform an operation.
public static int max(int num1, int num2) {
int result;
if (num1 > num2)
result = num1;
else
result = num2;
return result;
}
modifier
return value
type
method
name
formal
parameters
return value
method
body
method
header
parameter list
Define a method Invoke a method
int z = max(x, y);
actual parameters
(arguments)
method
signature
5. 5Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Method Signature
Method signature is the combination of the method name and the
parameter list.
public static int max(int num1, int num2) {
int result;
if (num1 > num2)
result = num1;
else
result = num2;
return result;
}
modifier
return value
type
method
name
formal
parameters
return value
method
body
method
header
parameter list
Define a method Invoke a method
int z = max(x, y);
actual parameters
(arguments)
method
signature
6. 6Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Formal Parameters
The variables defined in the method header are known as
formal parameters.
public static int max(int num1, int num2) {
int result;
if (num1 > num2)
result = num1;
else
result = num2;
return result;
}
modifier
return value
type
method
name
formal
parameters
return value
method
body
method
header
parameter list
Define a method Invoke a method
int z = max(x, y);
actual parameters
(arguments)
method
signature
7. 7Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Actual Parameters
When a method is invoked, you pass a value to the parameter. This
value is referred to as actual parameter or argument.
public static int max(int num1, int num2) {
int result;
if (num1 > num2)
result = num1;
else
result = num2;
return result;
}
modifier
return value
type
method
name
formal
parameters
return value
method
body
method
header
parameter list
Define a method Invoke a method
int z = max(x, y);
actual parameters
(arguments)
method
signature
8. 8Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Return Value Type
A method may return a value. The returnValueType is the data
type of the value the method returns. If the method does not return
a value, the returnValueType is the keyword void. For example, the
returnValueType in the main method is void.
public static int max(int num1, int num2) {
int result;
if (num1 > num2)
result = num1;
else
result = num2;
return result;
}
modifier
return value
type
method
name
formal
parameters
return value
method
body
method
header
parameter list
Define a method Invoke a method
int z = max(x, y);
actual parameters
(arguments)
method
signature
9. 9Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Calling Methods
Listing 2.1 Testing the max method
This program demonstrates calling a method max
to return the largest of the int values
TestMaxTestMax
10. 10Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Calling Methods, cont.
public static void main(String[] args) {
int i = 5;
int j = 2;
int k = max(i, j);
System.out.println(
"The maximum between " + i +
" and " + j + " is " + k);
}
public static int max(int num1, int num2) {
int result;
if (num1 > num2)
result = num1;
else
result = num2;
return result;
}
pass the value of i
pass the value of j
animation
11. 11Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Trace Method Invocation
public static void main(String[] args) {
int i = 5;
int j = 2;
int k = max(i, j);
System.out.println(
"The maximum between " + i +
" and " + j + " is " + k);
}
public static int max(int num1, int num2) {
int result;
if (num1 > num2)
result = num1;
else
result = num2;
return result;
}
i is now 5
animation
12. 12Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Trace Method Invocation
public static void main(String[] args) {
int i = 5;
int j = 2;
int k = max(i, j);
System.out.println(
"The maximum between " + i +
" and " + j + " is " + k);
}
public static int max(int num1, int num2) {
int result;
if (num1 > num2)
result = num1;
else
result = num2;
return result;
}
j is now 2
animation
13. 13Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Trace Method Invocation
public static void main(String[] args) {
int i = 5;
int j = 2;
int k = max(i, j);
System.out.println(
"The maximum between " + i +
" and " + j + " is " + k);
}
public static int max(int num1, int num2) {
int result;
if (num1 > num2)
result = num1;
else
result = num2;
return result;
}
invoke max(i, j)
animation
14. 14Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Trace Method Invocation
public static void main(String[] args) {
int i = 5;
int j = 2;
int k = max(i, j);
System.out.println(
"The maximum between " + i +
" and " + j + " is " + k);
}
public static int max(int num1, int num2) {
int result;
if (num1 > num2)
result = num1;
else
result = num2;
return result;
}
invoke max(i, j)
Pass the value of i to num1
Pass the value of j to num2
animation
15. 15Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Trace Method Invocation
public static void main(String[] args) {
int i = 5;
int j = 2;
int k = max(i, j);
System.out.println(
"The maximum between " + i +
" and " + j + " is " + k);
}
public static int max(int num1, int num2) {
int result;
if (num1 > num2)
result = num1;
else
result = num2;
return result;
}
declare variable result
animation
16. 16Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Trace Method Invocation
public static void main(String[] args) {
int i = 5;
int j = 2;
int k = max(i, j);
System.out.println(
"The maximum between " + i +
" and " + j + " is " + k);
}
public static int max(int num1, int num2) {
int result;
if (num1 > num2)
result = num1;
else
result = num2;
return result;
}
(num1 > num2) is true since
num1 is 5 and num2 is 2
animation
17. 17Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Trace Method Invocation
public static void main(String[] args) {
int i = 5;
int j = 2;
int k = max(i, j);
System.out.println(
"The maximum between " + i +
" and " + j + " is " + k);
}
public static int max(int num1, int num2) {
int result;
if (num1 > num2)
result = num1;
else
result = num2;
return result;
}
result is now 5
animation
18. 18Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Trace Method Invocation
public static void main(String[] args) {
int i = 5;
int j = 2;
int k = max(i, j);
System.out.println(
"The maximum between " + i +
" and " + j + " is " + k);
}
public static int max(int num1, int num2) {
int result;
if (num1 > num2)
result = num1;
else
result = num2;
return result;
}
return result, which is 5
animation
19. 19Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Trace Method Invocation
public static void main(String[] args) {
int i = 5;
int j = 2;
int k = max(i, j);
System.out.println(
"The maximum between " + i +
" and " + j + " is " + k);
}
public static int max(int num1, int num2) {
int result;
if (num1 > num2)
result = num1;
else
result = num2;
return result;
}
return max(i, j) and assign the
return value to k
animation
20. 20Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Trace Method Invocation
public static void main(String[] args) {
int i = 5;
int j = 2;
int k = max(i, j);
System.out.println(
"The maximum between " + i +
" and " + j + " is " + k);
}
public static int max(int num1, int num2) {
int result;
if (num1 > num2)
result = num1;
else
result = num2;
return result;
}
Execute the print statement
animation
21. 21Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
CAUTION
A return statement is required for a value-returning method. The
method shown below in (a) is logically correct, but it has a
compilation error because the Java compiler thinks it possible that
this method does not return any value.
To fix this problem, delete if (n < 0) in (a), so that the compiler
will see a return statement to be reached regardless of how the if
statement is evaluated.
public static int sign(int n) {
if (n > 0)
return 1;
else if (n == 0)
return 0;
else if (n < 0)
return –1;
}
(a)
Should be
(b)
public static int sign(int n) {
if (n > 0)
return 1;
else if (n == 0)
return 0;
else
return –1;
}
22. 22Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Reuse Methods from Other Classes
NOTE: One of the benefits of methods is for reuse. The max
method can be invoked from any class besides TestMax. If
you create a new class Test, you can invoke the max method
using ClassName.methodName (e.g., TestMax.max).
23. 23Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
void Method Example
This type of method does not return a value. The method
performs some actions.
TestVoidMethodTestVoidMethod
24. 24Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Scope of Local Variables
A local variable: a variable defined inside a
method.
Scope: the part of the program where the
variable can be referenced.
The scope of a local variable starts from its
declaration and continues to the end of the
block that contains the variable. A local
variable must be declared before it can be
used.
25. 25Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Scope of Local Variables, cont.
You can declare a local variable with the
same name multiple times in different non-
nesting blocks in a method, but you cannot
declare a local variable twice in nested
blocks.
26. 26Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Scope of Local Variables, cont.
A variable declared in the initial action part of a for loop
header has its scope in the entire loop. But a variable
declared inside a for loop body has its scope limited in the
loop body from its declaration and to the end of the block
that contains the variable.
public static void method1() {
.
.
for (int i = 1; i < 10; i++) {
.
.
int j;
.
.
.
}
}
The scope of j
The scope of i
27. 27Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Scope of Local Variables, cont.
public static void method1() {
int x = 1;
int y = 1;
for (int i = 1; i < 10; i++) {
x += i;
}
for (int i = 1; i < 10; i++) {
y += i;
}
}
It is fine to declare i in two
non-nesting blocks
public static void method2() {
int i = 1;
int sum = 0;
for (int i = 1; i < 10; i++) {
sum += i;
}
}
It is wrong to declare i in
two nesting blocks
28. 28Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Scope of Local Variables, cont.
// Fine with no errors
public static void correctMethod() {
int x = 1;
int y = 1;
// i is declared
for (int i = 1; i < 10; i++) {
x += i;
}
// i is declared again
for (int i = 1; i < 10; i++) {
y += i;
}
}
29. 29Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671
Scope of Local Variables, cont.
// With no errors
public static void incorrectMethod() {
int x = 1;
int y = 1;
for (int i = 1; i < 10; i++) {
int x = 0;
x += i;
}
}