C# is a great programming language for modern development. Like any language, however, there are parts of the language and BCL that can trip you up if you have invalid assumptions as to what is going on behind the scenes. This presentation discusses a few of these pitfalls and how to avoid them.
A small presentation I developed that introduces lambda expressions and many of the common LINQ extension methods for a group of developers that were less familiar with these concepts.
IBM Informix® Dynamic Server (IDS) 11 has new features to enable IDS applications to work with, store and search XML. This session discusses various scenarios and illustrates how to use and exploit these features.
C# is a great programming language for modern development. Like any language, however, there are parts of the language and BCL that can trip you up if you have invalid assumptions as to what is going on behind the scenes. This presentation discusses a few of these pitfalls and how to avoid them.
A small presentation I developed that introduces lambda expressions and many of the common LINQ extension methods for a group of developers that were less familiar with these concepts.
IBM Informix® Dynamic Server (IDS) 11 has new features to enable IDS applications to work with, store and search XML. This session discusses various scenarios and illustrates how to use and exploit these features.
Slides of my presentations at ApacheCon EU 07, see http://www.eu.apachecon.com/program/talk/84, and at the Cocoon GetTogether 2007, see http://www.cocoongt.org/
We've all seen the big "macro" features in .NET, this presentation is to give praise to the "Little Wonders" of .NET -- those little items in the framework that make life as a developer that much easier!
A powerful ORM tool to design data base access layer.
Fills gaps of mismatches between OOPs and RDBMS paradigm. Also maintains adequate ultra performance of database access.
An automated, configurable persistence of java objects with tables in data base.
May not be a good solution for data-centric application which uses only stored procedures to implement business logic in the database.
Slides of my presentations at ApacheCon EU 07, see http://www.eu.apachecon.com/program/talk/84, and at the Cocoon GetTogether 2007, see http://www.cocoongt.org/
We've all seen the big "macro" features in .NET, this presentation is to give praise to the "Little Wonders" of .NET -- those little items in the framework that make life as a developer that much easier!
A powerful ORM tool to design data base access layer.
Fills gaps of mismatches between OOPs and RDBMS paradigm. Also maintains adequate ultra performance of database access.
An automated, configurable persistence of java objects with tables in data base.
May not be a good solution for data-centric application which uses only stored procedures to implement business logic in the database.
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra Sencha
In this session, Lee will cover the top 10 new features of ECMAScript 2015, their benefits, and go through code examples of how to use them. She will also talk about ECMAScript 2015 compatibilities and incompatibilities with the most widely used browsers today, and how you should plan on developing your applications with ECMAScript 2015.
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfJay Das
With the advent of artificial intelligence or AI tools, project management processes are undergoing a transformative shift. By using tools like ChatGPT, and Bard organizations can empower their leaders and managers to plan, execute, and monitor projects more effectively.
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisGlobus
JASMIN is the UK’s high-performance data analysis platform for environmental science, operated by STFC on behalf of the UK Natural Environment Research Council (NERC). In addition to its role in hosting the CEDA Archive (NERC’s long-term repository for climate, atmospheric science & Earth observation data in the UK), JASMIN provides a collaborative platform to a community of around 2,000 scientists in the UK and beyond, providing nearly 400 environmental science projects with working space, compute resources and tools to facilitate their work. High-performance data transfer into and out of JASMIN has always been a key feature, with many scientists bringing model outputs from supercomputers elsewhere in the UK, to analyse against observational or other model data in the CEDA Archive. A growing number of JASMIN users are now realising the benefits of using the Globus service to provide reliable and efficient data movement and other tasks in this and other contexts. Further use cases involve long-distance (intercontinental) transfers to and from JASMIN, and collecting results from a mobile atmospheric radar system, pushing data to JASMIN via a lightweight Globus deployment. We provide details of how Globus fits into our current infrastructure, our experience of the recent migration to GCSv5.4, and of our interest in developing use of the wider ecosystem of Globus services for the benefit of our user community.
Cyaniclab : Software Development Agency Portfolio.pdfCyanic lab
CyanicLab, an offshore custom software development company based in Sweden,India, Finland, is your go-to partner for startup development and innovative web design solutions. Our expert team specializes in crafting cutting-edge software tailored to meet the unique needs of startups and established enterprises alike. From conceptualization to execution, we offer comprehensive services including web and mobile app development, UI/UX design, and ongoing software maintenance. Ready to elevate your business? Contact CyanicLab today and let us propel your vision to success with our top-notch IT solutions.
Check out the webinar slides to learn more about how XfilesPro transforms Salesforce document management by leveraging its world-class applications. For more details, please connect with sales@xfilespro.com
If you want to watch the on-demand webinar, please click here: https://www.xfilespro.com/webinars/salesforce-document-management-2-0-smarter-faster-better/
Globus Connect Server Deep Dive - GlobusWorld 2024Globus
We explore the Globus Connect Server (GCS) architecture and experiment with advanced configuration options and use cases. This content is targeted at system administrators who are familiar with GCS and currently operate—or are planning to operate—broader deployments at their institution.
Code reviews are vital for ensuring good code quality. They serve as one of our last lines of defense against bugs and subpar code reaching production.
Yet, they often turn into annoying tasks riddled with frustration, hostility, unclear feedback and lack of standards. How can we improve this crucial process?
In this session we will cover:
- The Art of Effective Code Reviews
- Streamlining the Review Process
- Elevating Reviews with Automated Tools
By the end of this presentation, you'll have the knowledge on how to organize and improve your code review proces
Large Language Models and the End of ProgrammingMatt Welsh
Talk by Matt Welsh at Craft Conference 2024 on the impact that Large Language Models will have on the future of software development. In this talk, I discuss the ways in which LLMs will impact the software industry, from replacing human software developers with AI, to replacing conventional software with models that perform reasoning, computation, and problem-solving.
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
Unlocking Business Potential: Tailored Technology Solutions by Prosigns
Discover how Prosigns, a leading technology solutions provider, partners with businesses to drive innovation and success. Our presentation showcases our comprehensive range of services, including custom software development, web and mobile app development, AI & ML solutions, blockchain integration, DevOps services, and Microsoft Dynamics 365 support.
Custom Software Development: Prosigns specializes in creating bespoke software solutions that cater to your unique business needs. Our team of experts works closely with you to understand your requirements and deliver tailor-made software that enhances efficiency and drives growth.
Web and Mobile App Development: From responsive websites to intuitive mobile applications, Prosigns develops cutting-edge solutions that engage users and deliver seamless experiences across devices.
AI & ML Solutions: Harnessing the power of Artificial Intelligence and Machine Learning, Prosigns provides smart solutions that automate processes, provide valuable insights, and drive informed decision-making.
Blockchain Integration: Prosigns offers comprehensive blockchain solutions, including development, integration, and consulting services, enabling businesses to leverage blockchain technology for enhanced security, transparency, and efficiency.
DevOps Services: Prosigns' DevOps services streamline development and operations processes, ensuring faster and more reliable software delivery through automation and continuous integration.
Microsoft Dynamics 365 Support: Prosigns provides comprehensive support and maintenance services for Microsoft Dynamics 365, ensuring your system is always up-to-date, secure, and running smoothly.
Learn how our collaborative approach and dedication to excellence help businesses achieve their goals and stay ahead in today's digital landscape. From concept to deployment, Prosigns is your trusted partner for transforming ideas into reality and unlocking the full potential of your business.
Join us on a journey of innovation and growth. Let's partner for success with Prosigns.
We describe the deployment and use of Globus Compute for remote computation. This content is aimed at researchers who wish to compute on remote resources using a unified programming interface, as well as system administrators who will deploy and operate Globus Compute services on their research computing infrastructure.
Enhancing Research Orchestration Capabilities at ORNL.pdfGlobus
Cross-facility research orchestration comes with ever-changing constraints regarding the availability and suitability of various compute and data resources. In short, a flexible data and processing fabric is needed to enable the dynamic redirection of data and compute tasks throughout the lifecycle of an experiment. In this talk, we illustrate how we easily leveraged Globus services to instrument the ACE research testbed at the Oak Ridge Leadership Computing Facility with flexible data and task orchestration capabilities.
Understanding Globus Data Transfers with NetSageGlobus
NetSage is an open privacy-aware network measurement, analysis, and visualization service designed to help end-users visualize and reason about large data transfers. NetSage traditionally has used a combination of passive measurements, including SNMP and flow data, as well as active measurements, mainly perfSONAR, to provide longitudinal network performance data visualization. It has been deployed by dozens of networks world wide, and is supported domestically by the Engagement and Performance Operations Center (EPOC), NSF #2328479. We have recently expanded the NetSage data sources to include logs for Globus data transfers, following the same privacy-preserving approach as for Flow data. Using the logs for the Texas Advanced Computing Center (TACC) as an example, this talk will walk through several different example use cases that NetSage can answer, including: Who is using Globus to share data with my institution, and what kind of performance are they able to achieve? How many transfers has Globus supported for us? Which sites are we sharing the most data with, and how is that changing over time? How is my site using Globus to move data internally, and what kind of performance do we see for those transfers? What percentage of data transfers at my institution used Globus, and how did the overall data transfer performance compare to the Globus users?
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Anthony Dahanne
Les Buildpacks existent depuis plus de 10 ans ! D’abord, ils étaient utilisés pour détecter et construire une application avant de la déployer sur certains PaaS. Ensuite, nous avons pu créer des images Docker (OCI) avec leur dernière génération, les Cloud Native Buildpacks (CNCF en incubation). Sont-ils une bonne alternative au Dockerfile ? Que sont les buildpacks Paketo ? Quelles communautés les soutiennent et comment ?
Venez le découvrir lors de cette session ignite
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I didn't get rich from it but it did have 63K downloads (powered possible tens of thousands of websites).
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Mind IT Systems
Healthcare providers often struggle with the complexities of chronic conditions and remote patient monitoring, as each patient requires personalized care and ongoing monitoring. Off-the-shelf solutions may not meet these diverse needs, leading to inefficiencies and gaps in care. It’s here, custom healthcare software offers a tailored solution, ensuring improved care and effectiveness.
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamtakuyayamamoto1800
In this slide, we show the simulation example and the way to compile this solver.
In this solver, the Helmholtz equation can be solved by helmholtzFoam. Also, the Helmholtz equation with uniformly dispersed bubbles can be simulated by helmholtzBubbleFoam.
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus
As part of the DOE Integrated Research Infrastructure (IRI) program, NERSC at Lawrence Berkeley National Lab and ALCF at Argonne National Lab are working closely with General Atomics on accelerating the computing requirements of the DIII-D experiment. As part of the work the team is investigating ways to speedup the time to solution for many different parts of the DIII-D workflow including how they run jobs on HPC systems. One of these routes is looking at Globus Compute as a way to replace the current method for managing tasks and we describe a brief proof of concept showing how Globus Compute could help to schedule jobs and be a tool to connect compute at different facilities.
Experience our free, in-depth three-part Tendenci Platform Corporate Membership Management workshop series! In Session 1 on May 14th, 2024, we began with an Introduction and Setup, mastering the configuration of your Corporate Membership Module settings to establish membership types, applications, and more. Then, on May 16th, 2024, in Session 2, we focused on binding individual members to a Corporate Membership and Corporate Reps, teaching you how to add individual members and assign Corporate Representatives to manage dues, renewals, and associated members. Finally, on May 28th, 2024, in Session 3, we covered questions and concerns, addressing any queries or issues you may have.
For more Tendenci AMS events, check out www.tendenci.com/events
How Recreation Management Software Can Streamline Your Operations.pptxwottaspaceseo
Recreation management software streamlines operations by automating key tasks such as scheduling, registration, and payment processing, reducing manual workload and errors. It provides centralized management of facilities, classes, and events, ensuring efficient resource allocation and facility usage. The software offers user-friendly online portals for easy access to bookings and program information, enhancing customer experience. Real-time reporting and data analytics deliver insights into attendance and preferences, aiding in strategic decision-making. Additionally, effective communication tools keep participants and staff informed with timely updates. Overall, recreation management software enhances efficiency, improves service delivery, and boosts customer satisfaction.
Software Engineering, Software Consulting, Tech Lead.
Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Security,
Spring Transaction, Spring MVC,
Log4j, REST/SOAP WEB-SERVICES.
2. RECAP
Logic
Logical variables
Conditional, Negation, Contrapositive,Biconditional
AND, OR,NOT,XOR
Logic gates
TruthTables
BooleanAlgebra
Examples
Q&A
MicrosoftVisio
Microsoft Project
Spreadsheet Concepts:
Using Microsoft Excel
Creating Charts in Microsoft Excel
Debugging Concepts Using Microsoft Excel
Presentation Concepts Using Microsoft PowerPoint
Image Concepts
Memory
Memory Cell
CPU
Register
Program Counter
Fetch-Execute Cycle
Q&A
File Management
Word Processing Basics Using MicrosoftWord
MicrosoftWord Layout and Graphics Features
Making and using compressed Files
WinZip, 7Zip
Notepad++
Wordpad
Adobe acrobat
Sumatra PDF
MathType
Database
Flat & Relational
Database
DBMS
Tables & Fields
Creating Tables in
Access
Design view and Data
Sheet View
Primary Key &
Foreign key
Relationships & ER
Diagram
Queries &Simple SQL
Cyber Security
Security Problems
Interception
Spoofing
Falsification
Repudiation
Security Technologies
Encryption
MAC
Data Model
Algorithm
Ingredients
Variables
Constructs
Pseudocode
Flowchart
Symbols
Flowcharting
examples
Q&A
9. JavaScript doesn’t need to be run through any
form of compiler that interprets our human-
readable code into something the browser can
understand.
The browser effectively reads the code and
interprets it on the fly.
Javascript
13. Adding Javascript to a Page
Like CSS,
you can embed a script right in a document or
keep it in an external file and link it to the page.
Embedded
Script
External
scripts
14. Adding Javascript to a Page
• To embed a script on a page, just add the code
as thecontent of a script element:
• <script>
• … JavaScript code goes here
• </script>
Embedded
Script
• The other method uses the src attribute to
point to a script file (with a .js suffix) by its
URL. In this case, the script element has no
content.
• <script src="my_script.js"></script>
External
scripts
15. Adding Javascript to a Page
<html>
<head> </head>
<body>
<script>
document.write("<h1>HelloWorld!</h1>");
</script>
</body>
</html>
16. The placement depends on when it should be executed.
Javascript can be placed for scripts
either in the head of the document or at the very end of the body.
Script Placement
• The best place to reference JavaScript files is right before the closing</bo
dy> tag so that the JavaScript file is loaded after all of the HTML has been
parsed.
• Putting it in header blocks the rendering of the page unless the whole file
is downloaded and executed, so moving the script to the bottom
improves the perceived performance.
• However, at times, JavaScript is needed to help render HTML and
determine it’s behavior, thus may be referenced within a document’s head
17. The placement depends on when it should be executed.
Javascript can be placed for scripts
either in the head of the document or at the very end of the body.
Script Placement
JS in head
<html>
<head>
<script>
</script>
</head>
<body>
</body>
</html>
JS in body
<html>
<head> </head>
<body>
<script>
</script>
</body>
</html>
18. Adding Javascript to a Page
<html>
<head>
<title></title>
<script type="text/javascript">
alert("This is an alert box!");
</script>
</head>
<body>
</body>
</html>
19. External JavaScript
Scripts can also be placed in external files.
External scripts are useful and practical when the same
code is used in a number of different web pages.
JavaScript files have the file extension.js
22. A statement is a command that tells the
browser what to do.
A script is made up of a series of statements.
For example,alert("Thankyou.");is a statement.
The semicolon at the end indicates the end of the statement.
Statement
23. Single-line comments,
use two slash characters (//) at the beginning of the
line.
// This is a single-line comment.
Multiple-line comments
use the same syntax that you’ve seen in CSS.
Everything within the /* */ characters is ignored by
the browser.
Comments
/* This is a multi-line comment.
Anything between these sets of characters will be
completely ignored when the script is executed.
This form of comment needs to be closed. */
24. alert()
Alerts the user with some Message
Used for OUTPUT
9/27/2018
Dr.AtifShahzad
24
alert("Thanks for visiting");
27. prompt()
The prompt() method takes two parameters.
The first is the label, which you want to display in the text
box.
The second is a default string to display in the text box
(optional).
9/27/2018
Dr.AtifShahzad
27
A prompt box is often used
to have the user input a value
before entering a page.
When a prompt box pops up,
the user will have to click
either OK or Cancel to proceed
after entering the input value.
If the user clicks OK, the
box returns the input value. If
the user clicks Cancel, the box
returns null.
var user = prompt("Please enter your name");
alert(user);
Used for
INPUT
28. A variable is like an information container.
You give it a name and then assign it a value, which can be a
number, text string, an element in the DOM, or a function.
The following declaration creates a variable with the name
“foo” and assigns it the value 5:
var foo = 5;
Variables
29. Undefined
The simplest of these data types is “undefined.” If we
declare a variable by giving it a name but no value, that
variable contains a value of “undefined.”
var foo;
alert(foo); // This will open a dialog containing "undefined".
Null
Assigning a variable of “null” (again, case-sensitive) simply
says,“Define this variable, but give it no inherent value.”
var foo = null;
alert(foo); // This will open a dialog containing "null".
Data types
30. Numbers
You can assign variables numeric values.
var foo = 5;
alert(foo); // This will open a dialog
containing "5".
The word “foo” now means the exact same thing as
the number five. Because JavaScript is “loosely
typed,” we don’t have to tell our script to treat the
variable foo as the number five.
Data types
31. Numbers
We can use classic mathematical notation: +,-,
*, and / for plus, minus, multiply, and divide,
respectively.
In this example, we use the plus sign (+) to add
foo to itself (foo + foo).
var foo = 5;
alert(foo + foo); // This will alert "10".
Data types
32. Strings
a line of text.
Enclosing characters in a set of single or double quotes
indicates that it’s a string.
var foo = "five";
alert( foo ); // This will alert "five"
The variable foo is now treated exactly the same as the word
“five”.
Data types
33. Strings
When the plus sign is used with strings, it sticks the strings
together (called concatenation) into one long string, as shown
in this example.
var foo = "bye"
alert (foo + foo); // This will alert "byebye“
var foo = "5";
alert( foo + foo ); // This will alert "55“
var foo = "five";
var bar = 5;
alert( foo + bar ); // This will alert "five5"
Data types
34. Strings
var mystring1 = "I am learning ";
var mystring2 = "JavaScript in IE321.";
document.write(mystring1 + mystring2);
Data types
35. Boolean
assign a variable a true or false value.
Boolean values use the true and false keywords
built into JavaScript, so quotation marks are
NOT necessary.
var foo = true; // The variable "foo" is now true
Data types
38. Increment/decrement Operators
Increment ++
• The increment operator increments the numeric value of its
operand by one. If placed before the operand, it returns the
incremented value. If placed after the operand, it returns the
original value and then increments the operand.
Decrement --
• The decrement operator decrements the numeric value of its
operand by one. If placed before the operand, it returns the
decremented value. If placed after the operand, it returns the
original value and then decrements the operand.
9/27/2018
Dr.AtifShahzad
38
40. A group of multiple values (called members) that
can be assigned to a single variable.
It is a way to store a list of items, or values.
The values in an array are said to be
indexed,
meaning you can refer to them by number according to the
order in which they appear in the list.The first member is
given the index number 0, the second is 1, and so on.
Arrays
41. For example,values in the array foo can be
accessed by referencing their index
number:
var foo = [5, "five", "5"];
alert( foo[0] ); // Alerts "5"
alert( foo[1] ); // Alerts "five"
alert( foo[2] ); // Also alerts "5"
Arrays
42. To compare two values,
JavaScript evaluates the statement and gives us
back a Boolean value depending on whether the
statement is true or false.
• == Is equal to
!= Is not equal to
• === Is identical to (equal to and of the same data type)
!== Is not identical to
> Is greater than
>= Is greater than or equal to
< Is less than
<= Is less than or equal to
Comparison Operators
43. alert( 5 == 5 ); // This will alert "true"
alert( 5 != 6 ); // This will alert "true"
alert( 5 < 1 ); // This will alert "false"
Comparison Operators
44. If/else statements are how we get
JavaScript to ask itself a true/false
question.
structure of a conditional statement:
if( true ) {
// Do something.
}
If/else statements
45. var foo = [5, "five", "5"];
if( foo[1] === "five" ) {
alert("This is the word five, written in plain English.");}
In this case, the alert would fire because the foo variable with an
index of 1 (the second in the list) is identical to “five”.
var test = "testing";
if( test == "testing" ) {
alert( "You haven't changed anything." );
} else {
alert( "You've changed something!" );
}
If/else statements
46. switch (expression) {
case n1:
statements
break;
case n2:
statements
break;
default:
statements
}
Switch Statement
when you need to
test for multiple
conditions
47. var day = 2;
switch (day) {
case 1:
document.write("Monday");
break;
case 2:
document.write("Tuesday");
break;
case 3:
document.write("Wednesday");
break;
default:
document.write("Another day");
}
// Outputs "Tuesday"
Switch Statement
48. There are cases in which we’ll want to go
through every item in an array and do
something with it,
several ways to write a loop, but the for
method is one of the most popular.
Loops
49. basic structure:
for( initialize the variable; test the condition; alter the value; )
{
// do something
}
Here is an example of a for loop in action.
for( var i = 0; i <= 2; i++ ) {
alert( i ); //This loop will trigger three alerts, reading "0", "1“,
and "2" respectively.
}
for Loops
50. check each item in an array” example.
var items = ["foo", "bar", "baz"];// First we create an array.
for( var i = 0; i <= items.length; i++ ) {
alert( items[i] ); //This will alert each item in the array.
}
For Loop--Exp
items.length
•Instead of using a number to limit the number of times the loop runs, we’re using a property built right into
JavaScript to determine the “length” of our array, which is the number of items it contains.
.length
items[i]
•We can use i variable inside of the loop to reference each index of the array.
51. basic structure:
while (condition) {
code block
}
while Loop
The while loop repeats through
a block of code, as long as a
specified condition is true.
56. hundreds of predefined functions built
into JavaScript, including:
alert(), confirm(), and prompt()
» These functions trigger browser-level dialog boxes.
Date() : Returns the current date and time.
parseInt("123"):This function will, among other things, take a
string data type containing numbers and turn it into a number
data type.The string is passed to the function as an argument.
SetTimeout(functionName, 5000):Will execute a function after
a delay.The function is specified in the first argument, and the
delay is specified in milliseconds in the second (in the example,
5000 milliseconds equals 5 seconds).
Native functions
57. To create a custom function, we type the
function keyword followed by a name for
the function, followed by opening and closing parentheses, followed
by opening and closing curly brackets.
function name() {
// Our function code goes here.
}
Custom
functions
58. There are times when you’ll want a variable
that you’ve defined within a function to be
available anywhere throughout your script.
Other times, you may want to restrict it and
make it available only to the function it lives
in.
This notion of the availability of the variable is
known as its scope.
Variable Scope
59. A variable that can be used by any of the
scripts on your page is globally scoped.
A variable that’s available only within its
parent function is locally scoped.
JavaScript variables use functions to manage
their scope. If a variable is defined outside of
a function, it will be globally scoped and
available to all scripts.
Variable Scope
60. When you define a variable within a function and you want
it to be used only by that function, you can flag it as locally
scoped by preceding the variable name with the var
keyword.
var foo = "value";
To expose a variable within a function to
the global scope, we omit the var keyword
and simply define the variable:
foo = "value";
Local vs Global variable
61. A variable declared outside a
function, becomes GLOBAL.
var carName = "Volvo";
// code here can use carName function
myFunction() {
// code here can use carName
}
Local vs Global variable
62. • <!DOCTYPE html>
• <html>
• <body>
• <p onclick="myFunction(),myFunction1();"
>Th e local variable carName cannot be ac
cessed from code outside the function:</p
>
• <p id="demo"></p>
• <script src="function.js"></script>
• </body>
• </html>
• function myFunction() {
• var carName = "Volvo";
• }
• function myFunction1()
• {
• document.getElementById("demo").inner
HTML ="The type of carName is " + typeof
carName;
• }
Local vs Global Variables
63. The return statement stops the execution
of a function and returns a value from that
function.
Return Statement
64. function addNumbers(a,b) {
return a + b;
}
Any reference you make to that function gives you the
result of the function.
alert( addNumbers(2,5) ); //Alerts "7“
Return Statement
65. What will be the output of the following
function
function bar() {
return 3;
alert(“displays alert.");
}
var x = bar ();
alert(x)
Return Statement
68. <button id="btn" onclick="googleRedirect()">Redirect to Google!</button>
Browser Object Model
JavaScript gives you access to and the ability to manipulate the
parts of the browser window itself.
For example, we can make the browser to redirect to some URL on the click of a button.
You then call this function from the < body > element’ s onclick event, like so:
Then we can use this function to indicate where this browser should be redirected on the
click of a button.
To do this, first you need to add a function in a javascript file that is going to be
triggered when the button is clicked,
function googleRedirect()
{
window.location.assign("http://www.w
3schools.com");
}
69. Window Properties/ Methods
In JavaScript, the browser is known
as the window object. The window object has a number of
properties and methods that we can use to
interact with it.
70. Windows Events
For example, the onload
event handler triggers a
script when the document
loads.
Similarly onclick and
onmouseover handlers
trigger a script when the
user clicks or mouses over
an element, respectively.
An event is an action that can be detected with
JavaScript, such as when the document loads or
when the user clicks on an element or just
moves her mouse over it.
In scripts, an event is identified by an event
handler.
72. • There are three ways we can apply event handlers within a webpage.
Applying Event Handlers
• <body onclick="myFunction();"> /* myFunction
will now run when the user clicks anything within
'body' */As an HTML
attribute
• <script>
• window.onclick = myFunction; /* myFunction will
run when the user clicks anywhere within the
browser window */
• </script>
As a method attached
to the element
• <script>
• window.addEventListener("click", myFunction); /*
myFunction will run when the user clicks anywhere
within the browser window */
• </script>
Using
addEventListener
73. The DOM is a
collection of
nodes:
• Element nodes
• Attribute nodes
• Text nodes
Document Object Model
The Document Object Model, or DOM, represents
the web page that is loaded into the browser using a
series of objects.The main object is the document
object, which in turn contains several other child
objects.
74. • <html>
• <head>
• <title>Document title</title>
• <meta charset="utf-8">
• </head>
• <body>
• <div>
• <h2>Subhead</h2>
• <p>Paragraph text with a
<a href="foo.html">link</a> here.</p>
• </div>
• <div>
• <p>More text here.</p>
• </div>
• </body>
• </html>
Example DOM tree
75. • Dot Notation
• In order to access the different objects in the DOM, you start with the doc
ument object, working down to the object that holds the data you are aft
er.
• Each object is separated by a period or full - stop character; hence, this is
known as a dot notation .
• For example the statement in the following example says to look on the p
age (document), find the element that has the id value “beginner”, find t
he HTML content within that element (innerHTML),
• document.getElementById( "beginner" ).innerHTML;
Accessing
DOM Nodes
76. • There are several methods for accessing nodes in the document.
• By element name
• getElementsByTagName()
• document.getElementsByTagName("p");
• By id attribute value
• getElementById()
• This method returns a single element based on that element’s ID (the value of its id
attribute), which we provide to the method as an argument:
• document.getElementById("lead-photo");
Ways forAccessing Nodes
77. • By class attribute value
• getElementsByClassName()
• This allows you to access nodes in the document based on
the value of a class attribute
• document.getElementsByClassName("column");
• By selector
• querySelectorAll()
• It allows you to access nodes of the DOM based on a CSS-style selector.
• document.querySelectorAll(".sidebar p");
• Accessing an attribute value
• getAttribute()
• Toget the value of an attribute attached to an element node, we call getAttribute()
with a single argument: the attribute name.
• document.getElementById("lead-image").getAttribute("src")
Ways forAccessing Nodes
78. • DOM also gives us several built-in methods for manipulating
elements their attributes, and their contents.
• setAttribute()
• It is used to set the value of element attributes, for example here it sets src
attribute to a new image name. This method requires two arguments: the a
ttribute to be changed and the new value for that attribute.
• document.getElementById("lead-image"). setAttribute("src", "lespaul.jpg");
• innerHTML
• Suppose we need a quick way of adding a paragraph of text to the first element
on our page with a class of intro:
• document.getElementsByClassName("intro"). innerHTML =“<p>This is our intro text</p>";;
• Style
• DOM also allows us to add, modify, or remove a CSS style from an element using the style property. It
works similarly to applying a style with the inline styleattribute.
• document.getElementById("intro").style.color = "#fff";
Manipulating
Nodes