MongoDB World 2019: Fast Machine Learning Development with MongoDBMongoDB
Today an increasingly large number of products use machine learning to deliver a great personalized user experience, and workplace software is no exception. Learn how Spoke uses MongoDB to do dynamic model training in real time from user interaction data and automatically train and serve thousands of models, with multiple customized models per client.
MongoDB World 2019: A Complete Methodology to Data Modeling for MongoDBMongoDB
Are you new to schema design for MongoDB, or are looking for a more complete or agile process than what you are following currently? In this talk we will guide you through the phases of a flexible methodology that you can apply to projects ranging from small to large with very demanding requirements.
Quand utiliser MongoDB … Et quand vous en passer…MongoDB
> Qu'est-ce que MongoDB ?
> À quoi sert MongoDB ?
> Les points forts de MongoDB... Les points à améliorer
> Ce que les clients peuvent faire et ne pas faire avec MongoDB
> Cas d'utilisation inhabituels
> Quand utiliser MongoDB
MongoDB World 2019: Fast Machine Learning Development with MongoDBMongoDB
Today an increasingly large number of products use machine learning to deliver a great personalized user experience, and workplace software is no exception. Learn how Spoke uses MongoDB to do dynamic model training in real time from user interaction data and automatically train and serve thousands of models, with multiple customized models per client.
MongoDB World 2019: A Complete Methodology to Data Modeling for MongoDBMongoDB
Are you new to schema design for MongoDB, or are looking for a more complete or agile process than what you are following currently? In this talk we will guide you through the phases of a flexible methodology that you can apply to projects ranging from small to large with very demanding requirements.
Quand utiliser MongoDB … Et quand vous en passer…MongoDB
> Qu'est-ce que MongoDB ?
> À quoi sert MongoDB ?
> Les points forts de MongoDB... Les points à améliorer
> Ce que les clients peuvent faire et ne pas faire avec MongoDB
> Cas d'utilisation inhabituels
> Quand utiliser MongoDB
Support Dot Net avec C#. Ce cours traite les points suivants :
- Architecture .Net
- Les bases de C#
- Objet et Classe
- Héritage
- Encapsulation
- Polymorphisme
- Les exceptions
- Les entrées sorties
- Les interfaces graphiques
- Le multi Threading
- Programmation réseaux (Sockets et DataGram)
- Accès aux bases de données
Spring Web MVC is the original web framework built on the Servlet API and has been included in the Spring Framework from the very beginning. The formal name, “Spring Web MVC,” comes from the name of its source module (spring-webmvc), but it is more commonly known as “Spring MVC”.
Parallel to Spring Web MVC, Spring Framework 5.0 introduced a reactive-stack web framework whose name, “Spring WebFlux,” is also based on its source module (spring-webflux). This section covers Spring Web MVC.
Au Canada, on estime que 29 % des étudiants suivent au moins un cours en ligne durant leurs études universitaires, et que les inscriptions à de tels cours augmentent en moyenne de 8,75 % par année (Martel, 2015). Bien que de nombreuses études aient démontré qu’elle soit au moins aussi efficace que la formation traditionnelle (Bernard et al., 2004; Russel, 1999), la formation en ligne présenterait un taux d’abandon plus élevé qu’en formation traditionnelle : entre 25 % et 40 % comparativement à 10 % à 20 % sur campus (Levy, 2007). Un des objectifs premiers de l’analyse de l’apprentissage (learning analytics) consiste à aider les enseignants à identifier rapidement les étudiants à risque avant qu’il ne soit trop tard pour intervenir (Sclater et al., 2016). Même si l’analyse de l’apprentissage est encore à un stade de développement relativement précoce, il existe des preuves convaincantes qu’elle peut contribuer à améliorer la persévérance et la réussite (Sclater et al., 2016). L’objectif de cette communication est de définir le concept d’analyse d’apprentissage et de dresser un état des lieux des recherches menées jusqu’à présent, afin de conclure à savoir si ses prétentions concernant la persévérance et la réussite sont justifiées.
Construire une application sur l'architecture modèle-vue-contrôleur en PHP à partir d'un exemple simple : une liste de choses à faire, avec deux pages types : liste et détails.
Développement d'applications mobiles hybrides avec IONIC 2 et Angular 2. Depuis l'installation jusqu'à l'utilisation de plugins natifs tels que stockage de données, géolocalisation, liaison serveur API Rest...
Exemple d'application qui montre comment utiliser les bonnes pratiques de JEE pour développer un site web de commerce électronique en utilisant les outils :
- Eclipse comme environnement de développement
- Maven comme outil d’intégration
- JUnit comme Framework des tsts unitaire
- Spring IOC pour l'inversion de contrôle
- Spring MVC pour la couche web
- Spring Security pour la sécurité
- JPA, Hibernate
- Web Service SOAP
- Web Service REST
- Service RMI
Vous trouverez la formation complète ici:
http://www.alphorm.com/tutoriel/formation-en-ligne-le-langage-sql
Cette formation vous apprendra à comprendre et à maîtriser le langage SQL en environnement SGBDR.
Durant cette formation vous apprendrez à extraire, insérer, modifier et supprimer des données. Construire et comprendre des requêtes simples et complexes.
Cette formation permettra également aux administrateurs et développeurs de bases de données d'exploiter les informations de l'entreprise et de créer des objets, quel que soit le SGBDR qui les héberge.
A la fin de cette formation, le langage SQL n'aura plus de secrets pour vous !
JavaScript - Chapter 9 - TypeConversion and Regular Expressions WebStackAcademy
Type Conversion:
JavaScript is loosely typed language and most of the time operators automatically convert a value to the right type but there are also cases when we need to explicitly do type conversions.
While JavaScript provides numerous ways to convert data from one type to another but there are two most common data conversions :
Converting Values to String
Converting Values to Numbers
Regular Expressions:
A regular expression is an object that describes a pattern of characters.
The JavaScript RegExp class represents regular expressions, and both String and RegExp define methods that use regular expressions to perform powerful pattern-matching and search-and-replace functions on text.
Support Dot Net avec C#. Ce cours traite les points suivants :
- Architecture .Net
- Les bases de C#
- Objet et Classe
- Héritage
- Encapsulation
- Polymorphisme
- Les exceptions
- Les entrées sorties
- Les interfaces graphiques
- Le multi Threading
- Programmation réseaux (Sockets et DataGram)
- Accès aux bases de données
Spring Web MVC is the original web framework built on the Servlet API and has been included in the Spring Framework from the very beginning. The formal name, “Spring Web MVC,” comes from the name of its source module (spring-webmvc), but it is more commonly known as “Spring MVC”.
Parallel to Spring Web MVC, Spring Framework 5.0 introduced a reactive-stack web framework whose name, “Spring WebFlux,” is also based on its source module (spring-webflux). This section covers Spring Web MVC.
Au Canada, on estime que 29 % des étudiants suivent au moins un cours en ligne durant leurs études universitaires, et que les inscriptions à de tels cours augmentent en moyenne de 8,75 % par année (Martel, 2015). Bien que de nombreuses études aient démontré qu’elle soit au moins aussi efficace que la formation traditionnelle (Bernard et al., 2004; Russel, 1999), la formation en ligne présenterait un taux d’abandon plus élevé qu’en formation traditionnelle : entre 25 % et 40 % comparativement à 10 % à 20 % sur campus (Levy, 2007). Un des objectifs premiers de l’analyse de l’apprentissage (learning analytics) consiste à aider les enseignants à identifier rapidement les étudiants à risque avant qu’il ne soit trop tard pour intervenir (Sclater et al., 2016). Même si l’analyse de l’apprentissage est encore à un stade de développement relativement précoce, il existe des preuves convaincantes qu’elle peut contribuer à améliorer la persévérance et la réussite (Sclater et al., 2016). L’objectif de cette communication est de définir le concept d’analyse d’apprentissage et de dresser un état des lieux des recherches menées jusqu’à présent, afin de conclure à savoir si ses prétentions concernant la persévérance et la réussite sont justifiées.
Construire une application sur l'architecture modèle-vue-contrôleur en PHP à partir d'un exemple simple : une liste de choses à faire, avec deux pages types : liste et détails.
Développement d'applications mobiles hybrides avec IONIC 2 et Angular 2. Depuis l'installation jusqu'à l'utilisation de plugins natifs tels que stockage de données, géolocalisation, liaison serveur API Rest...
Exemple d'application qui montre comment utiliser les bonnes pratiques de JEE pour développer un site web de commerce électronique en utilisant les outils :
- Eclipse comme environnement de développement
- Maven comme outil d’intégration
- JUnit comme Framework des tsts unitaire
- Spring IOC pour l'inversion de contrôle
- Spring MVC pour la couche web
- Spring Security pour la sécurité
- JPA, Hibernate
- Web Service SOAP
- Web Service REST
- Service RMI
Vous trouverez la formation complète ici:
http://www.alphorm.com/tutoriel/formation-en-ligne-le-langage-sql
Cette formation vous apprendra à comprendre et à maîtriser le langage SQL en environnement SGBDR.
Durant cette formation vous apprendrez à extraire, insérer, modifier et supprimer des données. Construire et comprendre des requêtes simples et complexes.
Cette formation permettra également aux administrateurs et développeurs de bases de données d'exploiter les informations de l'entreprise et de créer des objets, quel que soit le SGBDR qui les héberge.
A la fin de cette formation, le langage SQL n'aura plus de secrets pour vous !
JavaScript - Chapter 9 - TypeConversion and Regular Expressions WebStackAcademy
Type Conversion:
JavaScript is loosely typed language and most of the time operators automatically convert a value to the right type but there are also cases when we need to explicitly do type conversions.
While JavaScript provides numerous ways to convert data from one type to another but there are two most common data conversions :
Converting Values to String
Converting Values to Numbers
Regular Expressions:
A regular expression is an object that describes a pattern of characters.
The JavaScript RegExp class represents regular expressions, and both String and RegExp define methods that use regular expressions to perform powerful pattern-matching and search-and-replace functions on text.
JavaScript String:
The String object lets you work with a series of characters; it wraps Javascript's string primitive data type with a number of helper methods.
As JavaScript automatically converts between string primitives and String objects, you can call any of the helper methods of the String object on a string primitive.
JavaScript Arrays:
The Array object lets you store multiple values in a single variable. It 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.
JavaScript - Chapter 4 - Types and StatementsWebStackAcademy
A computer program is a list of "instructions" to be "executed" by a computer.
In a programming language, these programming instructions are called statements.
A JavaScript program is a list of programming statements.
JavaScript statements are composed of:
Values, Operators, Expressions, Keywords, and Comments.
This statement tells the browser to write "Hello Dolly." inside an HTML element with id="demo":
JavaScript Data Types
JavaScript variables can hold many data types: numbers, strings, objects and more.
In programming, data types is an important concept.
To be able to operate on variables, it is important to know something about the type.
Regular Expressions: JavaScript And BeyondMax Shirshin
Regular Expressions is a powerful tool for text and data processing. What kind of support do browsers provide for that? What are those little misconceptions that prevent people from using RE effectively?
The talk gives an overview of the regular expression syntax and typical usage examples.
String Function
1. charAt():
This method returns the character from the specified index.Characters in a string are indexed from left to right. The index of the first character is 0, and the index of the last character in a string called stringName is stringName.length - 1.
Syntax:
string.charAt(index);
Return Value:
Returns the character from the specified index.
Example:
<html>
<head>
<title>JavaScript String charAt() Method</title>
</head>
<body>
</body>
</html>
Output:
str.charAt(0) is:T
2. concat():
Description:
This method adds two or more strings and returns a new single string.
Syntax:
string.concat(string2, string3[, ..., stringN]);
parameters:
string2...stringN : These are the strings to be concatenated.
Return Value:
Returns a single concatenated string.
Example:
<html>
<head>
<title>JavaScript String concat() Method</title>
</head>
<body>
</body>
</html>
Output:
Concatenated String :This is string oneThis is string two.
3. indexOf():
Description:
This method returns the index within the calling String object of the first occurrence of the specified value, starting the search at fromIndex or -1 if the value is not found.
Syntax:
string.indexOf(searchValue[, fromIndex])
Parameters:
searchValue : A string representing the value to search for.
fromIndex : The location within the calling string to start the search from. It can be any integer between 0 and the length of the string. The default value is 0.
Return Value:
Returns the index of the found occurrence otherwise -1 if not found.
Example:
<html>
<head>
<title>JavaScript String indexOf() Method</title>
</head>
<body>
<br />");
var index = str1.indexOf( "one" );
document.write("indexOf found String :" + index );
</body></html>
Oputput:
indexOf found String :8
indexOf found String :15
4. lastIndexOf():
Description:
This method returns the index within the calling String object of the last occurrence of the specified value, starting the search at fromIndex or -1 if the value is not found.
Syntax:
string.lastIndexOf(searchValue[, fromIndex])
Parameters:
searchValue : A string representing the value to search for.
fromIndex : The location within the calling string to start the search from. It can be any integer between 0 and the length of the string. The default value is 0.
Return Value:
Returns the index of the last found occurrence otherwise -1 if not found.
Example:
<html>
<head>
<title>JavaScri
In this chapter we will explore strings. We are going to explain how they are implemented in C# and in what way we can process text content. Additionally, we will go through different methods for manipulating a text: we will learn how to compare strings, how to search for substrings, how to extract substrings upon previously settled parameters and last but not least how to split a string by separator chars. We will demonstrate how to correctly build strings with the StringBuilder class. We will provide a short but very useful information for the most commonly used regular expressions. We will discuss some classes for efficient construction of strings. Finally, we will take a look at the methods and classes for achieving more elegant and stricter formatting of the text content.
Practical JavaScript Programming - Session 6/8Wilson Su
JavaScript is one of the most popular skills in today’s job market. It allows you to create both client- and server-side applications quickly and easily. Having a solid understanding of this powerful and versatile language is essential to anyone who uses it.
“Practical JavaScript Programming” does not only focus on best practices, but also introduces the fundamental concepts. This course will take you from JavaScript basics to advanced. You’ll learn about topics like Data Types, Functions, Events, AJAX and more.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Honest Reviews of Tim Han LMA Course Program.pptxtimhan337
Personal development courses are widely available today, with each one promising life-changing outcomes. Tim Han’s Life Mastery Achievers (LMA) Course has drawn a lot of interest. In addition to offering my frank assessment of Success Insider’s LMA Course, this piece examines the course’s effects via a variety of Tim Han LMA course reviews and Success Insider comments.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
Safalta Digital marketing institute in Noida, provide complete applications that encompass a huge range of virtual advertising and marketing additives, which includes search engine optimization, virtual communication advertising, pay-per-click on marketing, content material advertising, internet analytics, and greater. These university courses are designed for students who possess a comprehensive understanding of virtual marketing strategies and attributes.Safalta Digital Marketing Institute in Noida is a first choice for young individuals or students who are looking to start their careers in the field of digital advertising. The institute gives specialized courses designed and certification.
for beginners, providing thorough training in areas such as SEO, digital communication marketing, and PPC training in Noida. After finishing the program, students receive the certifications recognised by top different universitie, setting a strong foundation for a successful career in digital marketing.
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
Normal Labour/ Stages of Labour/ Mechanism of LabourWasim Ak
Normal labor is also termed spontaneous labor, defined as the natural physiological process through which the fetus, placenta, and membranes are expelled from the uterus through the birth canal at term (37 to 42 weeks
2. Manipulating Strings
String
◦ Text contained within double or single quotation marks
◦ Literal values or assigned to a variable
◦ Begin and end with same type of quotation mark
Example:
JAVASCRIPT, SIXTH EDITION 2
document.getElementById("mainHeading").innerHTML = "24-Hour↵
Forecast";
var highSurfAdvisory = "Watch out for high waves and strong↵
rip currents.";
3. Manipulating Strings (cont’d.)
Parsing
◦ Extracting characters or substrings from a larger string
Use String class to parse text strings in scripts
– Represents all literal strings and string variables in
JavaScript
◦ Contains methods for manipulating text strings
JAVASCRIPT, SIXTH EDITION 3
5. Formatting Strings (cont’d.)
Using special characters (cont’d.)
◦ fromCharCode() method
◦ Constructs a text string from Unicode character codes
◦ Syntax:
String.fromCharCode(char1, char2, ...)
◦ Examples:
JAVASCRIPT, SIXTH EDITION 5
String.fromCharCode(74,97,118,97,83,99,114,105,112,116)
copyrightInfo = String.fromCharCode(169) + " 2017";
6. Formatting Strings (cont’d.)
Changing case
◦ toLowerCase() and toUpperCase() methods
◦ Examples:
JAVASCRIPT, SIXTH EDITION 6
var agency = "noaa";
agencyName.innerHTML = agency.toUpperCase();
// browser displays "NOAA" but value of agency is still "noaa"
var agency = "noaa";
agency = agency.toUpperCase();
// value of agency is "NOAA"
agencyName.innerHTML = agency;
// browser displays "NOAA"
7. Counting Characters in a String
length property
◦ Returns the number of characters in a string
◦ Example:
JAVASCRIPT, SIXTH EDITION 7
var country = "Kingdom of Morocco";
var stringLength = country.length;
// value of stringLength is 18
8. Finding and Extracting
Characters and Substrings
JAVASCRIPT, SIXTH EDITION 8
Table 8-1 Search and extraction methods of the String
class (continues)
9. JAVASCRIPT, SIXTH EDITION 9
Table 8-1 Search and extraction methods of the String class
Finding and Extracting Characters and
Substrings (cont’d.)
10. JAVASCRIPT, SIXTH EDITION 10
Figure 8-5 Example uses of String class methods
Finding and Extracting Characters and
Substrings (cont’d.)
11. Finding and Extracting Characters
and Substrings (cont’d.)
Two types of string search methods
◦ Those that return a numeric position in a text string
◦ Character position in text string begins with a value of zero
◦ Can pass a second optional argument specifying the position in the string to start searching to
the indexOf() method
◦ Example: search() method
var email = "president@whitehouse.gov";
var atPosition = email.search("@"); // returns 9
JAVASCRIPT, SIXTH EDITION 11
12. Finding and Extracting Characters
and Substrings (cont’d.)
Two types of string search methods (cont'd.)
◦ Those that return a numeric position in a text string (cont'd.)
◦ Example: indexOf() method
var email = "president@whitehouse.gov";
var atIndex = email.indexOf("@", 10); // returns -1
JAVASCRIPT, SIXTH EDITION 12
13. Finding and Extracting Characters
and Substrings (cont’d.)
Two types of string search methods (cont’d.)
◦ Those that return a character or substring
◦ substring() or slice() method
JAVASCRIPT, SIXTH EDITION 13
var email = "president@whitehouse.gov";
var nameEnd = email.search("@");
// value of nameEnd is 9
var nameText = email.substring(0, nameEnd);
// value of nameText is "president"
14. Finding and Extracting Characters
and Substrings (cont’d.)
Extracting characters from the middle or end of a string
◦ Use the search(), indexOf(), lastIndexOf() methods
◦ lastIndexOf() method returns position of the last occurrence of one string in another
string
◦ Example:
JAVASCRIPT, SIXTH EDITION 14
var email = "president@whitehouse.gov";
var startDomainID = email.lastIndexOf(".");
// startDomainID value is 20
var domainID = email.substring(startDomainID + 1);
// domainID value is "gov"
15. Finding and Extracting Characters
and Substrings (cont’d.)
slice() method allows negative argument values for the index
arguments
◦ Specifying a negative value for the starting index
◦ slice() method starts at the end of the text string
◦ Specifying a negative value for the ending index
◦ Number of characters the slice() method extracts also starts at the end of the text string
slice() method does not return the character represented by the
ending index
◦ Returns the character immediately before the ending index
JAVASCRIPT, SIXTH EDITION 15
16. JAVASCRIPT, SIXTH EDITION 16
var email = "president@whitehouse.gov";
var nameText = email.slice(0,9);
// nameText value is "president"
var domain = email.slice(-14,-4);
// domain value is "whitehouse"
Finding and Extracting Characters and
Substrings (cont’d.)
17. Replacing Characters and
Substrings
replace() method
◦ Creates a new string with the first instance of a specified pattern
replaced with the value of the text argument
◦ Syntax: string.replace(pattern, text)
◦ Example:
JAVASCRIPT, SIXTH EDITION 17
var email = "president@whitehouse.gov";
var newEmail = email.replace("president", "vice.president");
// value of newEmail is "vice.president@whitehouse.gov"
18. Combining Characters and
Substrings
Combining strings
◦ Use the concatenation operator (+) and compound assignment operator (+=)
◦ Use the concat() method
◦ Creates a new string by combining strings passed as arguments
◦ Syntax: string.concat(value1, value2, ...)
◦ To combine text strings
◦ Easier to use the concatenation operator and the compound assignment operator
JAVASCRIPT, SIXTH EDITION 18
19. JAVASCRIPT, SIXTH EDITION 19
var name = "Theodor Seuss Geisel";
var penName = "Dr. Seuss";
var bio = penName.concat(" was the pen name of ", name);
// value of bio is
// "Dr. Seuss was the pen name of Theodor Seuss Geisel"
var name = "Theodor Seuss Geisel";
var penName = "Dr. Seuss";
var bio = penName + " was the pen name of " + name;
// value of bio is
// "Dr. Seuss was the pen name of Theodor Seuss Geisel"
Combining Characters and Substrings
(cont’d.)
20. Comparing Strings
Comparison operator (===) can be used with strings
◦ Compare individual characters according to their Unicode position
localeCompare() method
◦ Compares strings according to the particular sort order of a language or
country
◦ Performs a case-sensitive comparison of two strings
JAVASCRIPT, SIXTH EDITION 20
21. Working with Regular
Expressions
Regular expressions
◦ Patterns used for matching and manipulating strings according to specified
rules
◦ With scripting languages, most commonly used for validating submitted form
data
JAVASCRIPT, SIXTH EDITION 21
22. Defining Regular Expressions
in JavaScript
Regular expressions
◦ Must begin and end with forward slashes
◦ Example:
var urlProtocol = /https/;
Approaches to creating regular expressions
◦ Use regular expressions with several String class methods
◦ Pass pattern directly to a method
◦ Use the RegExp() constructor
◦ Contains methods and properties for working with regular expressions in JavaScript
JAVASCRIPT, SIXTH EDITION 22
23. Defining Regular Expressions
in JavaScript (cont’d.)
Approaches to creating regular expressions (cont’d.)
◦ Syntax for creating a regular expression with the RegExp() constructor
var regExpName = new RegExp("pattern"[, attributes]);
◦ Example:
var urlProtocol = new RegExp("https");
var url = "http://www.cengagebrain.com";
var searchResult = url.search(urlProtocol);
// returns -1
JAVASCRIPT, SIXTH EDITION 23
24. Using Regular Expression
Methods
RegExp object
◦ Includes two methods
◦ test() and exec()
test() method: returns a value of true
◦ If a string contains text that matches a regular expression
◦ Otherwise returns false value
◦ Syntax: var pattern = test(string);
Real power of regular expressions
◦ Comes from the patterns written
JAVASCRIPT, SIXTH EDITION 24
25. Writing Regular Expression
Patterns
Hardest part of working with regular expressions
◦ Writing the patterns and rules
◦ Example:
JAVASCRIPT, SIXTH EDITION 25
var emailPattern = /^[_a-zA-Z0-9-]+(.[_a-zA-Z0-9-]+)*↵
@[a-zA-Z0-9-]+(.[a-zA-Z0-9-]+)*(.[a-z]{2,6})$/;
var email = "president@whitehouse.gov";
var result;
if (emailPattern.test(email)) {
result = true;
} else {
result = false;
}
// value of result is true
26. Writing Regular Expression
Patterns (cont’d.)
Regular expression patterns consist of literal characters and
metacharacters
◦ Metacharacters: special characters that define the pattern matching rules in
a regular expression
JAVASCRIPT, SIXTH EDITION 26
28. Writing Regular Expression
Patterns (cont’d.)
Matching any character
◦ Period (.)
◦ Matches any single character in a pattern
◦ Specifies that the pattern must contain a value where the period located
Matching characters at the beginning or end of a string
◦ ^ metacharacter
◦ Matches characters at the beginning of a string
◦ $ metacharacter
◦ Matches characters at the end of a string
JAVASCRIPT, SIXTH EDITION 28
29. Writing Regular Expression
Patterns (cont’d.)
Matching characters at the beginning or end of a String (cont’d.)
◦ Anchor
◦ Pattern that matches the beginning or end of a line
◦ Specifying an anchor at the beginning of a line
◦ Pattern must begin with the ^ metacharacter
Matching special characters
◦ Precede the character with a backslash
JAVASCRIPT, SIXTH EDITION 29
30. Writing Regular Expression
Patterns (cont’d.)
Specifying quantity
◦ Quantifiers
◦ Metacharacters that specify the quantity of a match
JAVASCRIPT, SIXTH EDITION 30
Table 8-3 JavaScript regular expression quantifiers
31. Writing Regular Expression
Patterns (cont’d.)
Specifying subexpressions
◦ Subexpression or subpattern
◦ Characters contained in a set of parentheses within a regular expression
◦ Allows determination of the format and quantities of the enclosed characters as a group
JAVASCRIPT, SIXTH EDITION 31
32. Writing Regular Expression
Patterns (cont’d.)
Defining character classes
◦ Character classes
◦ Used in regular expressions to treat multiple characters as a single item
◦ Created by enclosing the characters that make up the class with bracket [] metacharacters
◦ Use a hyphen metacharacter (-) to specify a range of values in a character
class
◦ To specify optional characters to exclude in a pattern match
◦ Include the ^ metacharacter immediately before the characters in a character class
JAVASCRIPT, SIXTH EDITION 32
33. Writing Regular Expression
Patterns (cont’d.)
Defining character classes (cont’d.)
◦ Regular expressions include special escape characters in character classes
◦ To represent different types of data
JAVASCRIPT, SIXTH EDITION 33
Table 8-4 JavaScript character class expressions
34. Writing Regular Expression
Patterns (cont’d.)
Defining character classes (cont’d.)
◦ Matching multiple pattern choices
◦ Allow a string to contain an alternate set of substrings
◦ Separate the strings in a regular expression pattern with the | metacharacter
JAVASCRIPT, SIXTH EDITION 34
36. Setting Regular Expression
Properties (cont’d.)
Options for setting the values of these properties
◦ Assign a value of true or false to the property
◦ By creating a regular expression with the RegExp() constructor
◦ Use the flags when assigning a regular expression to a variable without using
the RegExp() constructor
JAVASCRIPT, SIXTH EDITION 36
37. Manipulating Arrays
Use the Array class length property and methods
Creating an array
◦ Instantiates an object from the Array class
JAVASCRIPT, SIXTH EDITION 37
39. Finding and Extracting
Elements and Values
Primary method for finding a value in an array
◦ Use a looping statement to iterate through the array until a particular value
found
Extract elements and values from an array
◦ Use the slice() method to return (copy) a portion of an array and assign
it to another array
Syntax for the slice() method
array_name.slice(start, end);
JAVASCRIPT, SIXTH EDITION 39
40. JAVASCRIPT, SIXTH EDITION 40
Figure 8-11 List of states
extracted using the
slice() method
var largestStates = ["Alaska", "Texas", "California",↵
"Montana", "New Mexico", "Arizona", "Nevada",↵
"Colorado", "Oregon", "Wyoming"];
var fiveLargestStates = largestStates.slice(0, 5);
for (var i = 0; i < fiveLargestStates.length; i++) {
var newItem = document.createElement("p");
newItem.innerHTML = fiveLargestStates[i];
document.body.appendChild(newItem);
}
Finding and Extracting Elements and
Values (cont’d.)
41. Manipulating Elements
Adding and removing elements to and from the beginning of an array
◦ shift() method removes and returns the first element from the beginning
of an array
◦ unshift() method adds one or more elements to the beginning of an
array
JAVASCRIPT, SIXTH EDITION 41
42. JAVASCRIPT, SIXTH EDITION 42
var colors = ["mauve", "periwinkle", "silver", "cherry",↵
"lemon"];
colors.shift(); // colors value now
// ["periwinkle", "silver", "cherry", "lemon"]
colors.unshift("yellow-orange", "violet");
// colors value now ["yellow-orange", "violet",
// "mauve", "periwinkle", "silver", "cherry", "lemon"]
Manipulating Elements (cont’d.)
43. Manipulating Elements
Adding and removing elements to and from the end of an array
◦ Use array’s length property to determine the next available index
JAVASCRIPT, SIXTH EDITION 43
var colors = ["mauve", "periwinkle", "silver", "cherry"];
colors[colors.length] = "lemon";
// colors value now ["mauve", "periwinkle", "silver",
// "cherry", "lemon"]
44. Manipulating Elements
(cont’d.)
Adding and removing elements to and from the end of an array (cont’d.)
◦ pop() method removes the last element from the end of an array
◦ push() method adds one or more elements to the end of an array
JAVASCRIPT, SIXTH EDITION 44
var colors = ["mauve", "periwinkle", "silver", "cherry"];
colors.pop();
// colors value now ["mauve", "periwinkle", "silver"]
colors.push("yellow-orange", "violet");
// colors value now ["mauve", "periwinkle", "silver",
// "yellow-orange", "violet"]
45. Manipulating Elements
(cont’d.)
Adding and removing elements within an array
◦ Use the splice() method
◦ Also renumbers the indexes in the array
◦ To add an element, include 0 as second argument
JAVASCRIPT, SIXTH EDITION 45
var hospitalDepts = ["Anesthesia", "Molecular Biology",↵
"Neurology", "Pediatrics"];
hospitalDepts.splice(3, 0, "Ophthalmology");
// value now ["Anesthesia", "Molecular Biology",
// "Neurology", "Ophthalmology", "Pediatrics"]
46. Manipulating Elements
(cont’d.)
Adding and removing elements within an array (cont'd.)
◦ Use the splice() method (cont'd.)
◦ To delete elements, omit third argument
◦ Indexes renumbered just like when elements added
JAVASCRIPT, SIXTH EDITION 46
var hospitalDepts = ["Anesthesia", "Molecular Biology",↵
"Neurology", "Pediatrics"];
hospitalDepts.splice(1, 2);
// value now ["Anesthesia", "Pediatrics"]
47. Sorting and Combining Arrays
Sorting arrays
◦ Sort elements of an array alphabetically
◦ Use the sort() method
JAVASCRIPT, SIXTH EDITION 47
var scientificFishNames = ["Quadratus taiwanae",↵
"Macquaria australasica", "Jordania zonope",↵
"Abudefduf sparoides", "Dactylopterus volitans",↵
"Wattsia mossambica", "Bagrus urostigma"];
scientificFishNames.sort();
// scientificFishNames value now
// ["Abudefduf sparoides", "Bagrus urostigma",
// "Dactylopterus volitans", "Jordania zonope",
// "Macquaria australasica", "Quadratus taiwanae",
// "Wattsia mossambica"]
48. Sorting and Combining Arrays
(cont'd.)
Sorting arrays (cont'd.)
◦ reverse() method
◦ Transposes, or reverses, the order of the elements in an array
JAVASCRIPT, SIXTH EDITION 48
scientificFishNames.reverse();
// scientificFishNames value now
// ["Wattsia mossambica", "Quadratus taiwanae",
// "Macquaria australasica", "Jordania zonope",
// "Dactylopterus volitans", "Bagrus urostigma",
// "Abudefduf sparoides"]
49. Sorting and Combining Arrays
(cont'd.)
Combining arrays
◦ Use the concat() method
◦ Syntax
array1.contact(array2, array3, ...);
JAVASCRIPT, SIXTH EDITION 49
50. Sorting and Combining Arrays
(cont'd.)
JAVASCRIPT, SIXTH EDITION 50
var Provinces = ["Newfoundland and Labrador",↵
"Prince Edward Island", "Nova Scotia",↵
"New Brunswick", "Quebec", "Ontario",↵
"Manitoba", "Saskatchewan", "Alberta",↵
"British Columbia"];
var Territories = ["Nunavut", "Northwest Territories",↵
"Yukon"];
var Canada = [];
Canada = Provinces.concat(Territories);
// value of Canada now ["Newfoundland and Labrador",
"Prince Edward Island", "Nova Scotia",
// "New Brunswick", "Quebec", "Ontario",
// "Manitoba", "Saskatchewan", "Alberta",
// "British Columbia", "Nunavut", "Northwest Territories", "Yukon"];
51. Converting Between Data
Types
Common task to convert strings and arrays to different data types
◦ strings to arrays
◦ arrays to strings
◦ objects to strings
◦ strings to objects
JAVASCRIPT, SIXTH EDITION 51
52. Converting Between Strings
and Arrays
split() method of the String class
◦ Splits a string into an indexed array
Syntax
array = string.split(separator[, limit]);
To split individual characters in a string into an array
◦ Pass an empty string ("") as the separator argument
JAVASCRIPT, SIXTH EDITION 52
53. JAVASCRIPT, SIXTH EDITION 53
var OPEC = "Algeria, Angola, Ecuador, Iran, Iraq, Kuwait,↵
Libya, Nigeria, Qatar, Saudi Arabia,↵
United Arab Emirates, Venezuela";
// The value of OPEC is a string
var opecArray = OPEC.split(", ");
// The value of opecArray is the following array:
// ["Algeria", "Angola", "Ecuador", "Iran", "Iraq",
// "Kuwait", "Libya", "Nigeria", "Qatar", "Saudi Arabia",
// "United Arab Emirates", "Venezuela"]
Converting Between Strings and Arrays
(cont’d.)
54. Converting Between Strings
and Arrays (cont’d.)
join() method of the Array class
◦ Combines array elements into a string, separated by a comma or specified
characters
Syntax
array.join(["separator"]);
To prevent elements from being separated by any characters in the new
string
◦ Pass an empty string ("") as the separator argument
JAVASCRIPT, SIXTH EDITION 54
55. JAVASCRIPT, SIXTH EDITION 55
var OPEC = ["Algeria", "Angola", "Ecuador", "Iran",↵
"Iraq", "Kuwait", "Libya", "Nigeria", "Qatar",↵
"Saudi Arabia", "United Arab Emirates", "Venezuela"];
// value of OPEC is an array
var opecString = OPEC.join();
// value of opecString is the following string:
// "Algeria, Angola, Ecuador, Iran, Iraq, Kuwait, Libya,
// Nigeria, Qatar, Saudi Arabia, United Arab Emirates,
// Venezuela"
Converting Between Strings and Arrays
(cont’d.)
56. Converting Between Strings
and Arrays (cont’d.)
join() method does not include a separator argument
◦ Previous example OPEC nations automatically separated by commas
◦ Can include a separator argument of ";"
JAVASCRIPT, SIXTH EDITION 56
var OPEC = ["Algeria", "Angola", "Ecuador", "Iran",↵
"Iraq", "Kuwait", "Libya", "Nigeria", "Qatar",↵
"Saudi Arabia", "United Arab Emirates", "Venezuela"];
// value of OPEC is an array
var opecString = OPEC.join(";");
// value of opecString is the following string:
// "Algeria;Angola;Ecuador;Iran;Iraq;Kuwait;Libya;
// Nigeria;Qatar;Saudi Arabia;United Arab Emirates;
// Venezuela"
57. Converting Between Strings
and Arrays (cont’d.)
Can also use the toString() and toLocaleString() method
◦ Convert an array to a string
◦ array.toString();
◦ array.toLocaleString();
JAVASCRIPT, SIXTH EDITION 57
58. Converting Between Strings
and JSON
JavaScript Object Notation (JSON)
◦ Represents a JavaScript object as a string
◦ Exchanges data between application and server
JSON object
◦ Supported in modern browsers, including IE8
JAVASCRIPT, SIXTH EDITION 58
Table 8-7 Methods of the JSON object
59. Converting Between Strings
and JSON (cont'd.)
Converting an Object to a String
◦ stringify() method
◦ string = JSON.stringify(value [, replacer [, space]]);
◦ string is name of variable that will contain string
◦ value represents JavaScript object to be converted
JAVASCRIPT, SIXTH EDITION 59
60. Converting Between Strings
and JSON (cont'd.)
Converting an Object to a String (cont'd.)
JAVASCRIPT, SIXTH EDITION 60
var newUser = {
fName: "Tony",
lName: "Chu"
},
newUserString = JSON.stringify(newUser);
// value of newUserString is
// '{"fName":"Tony","lName":"Chu"}'
61. Converting Between Strings
and JSON (cont'd.)
Converting a String to an Object
◦ parse() method
◦ object = JSON.parse(string [, function]);
◦ object is namve of variable that will contain object
◦ string represents JSON string to be converted
JAVASCRIPT, SIXTH EDITION 61
62. Converting Between Strings
and JSON (cont'd.)
Converting a String to an Object (cont'd.)
◦ JSON string definition:
◦ String because enclosed in quotes
◦ To convert string to JavaScript object:
JAVASCRIPT, SIXTH EDITION 62
var newUser = '{"fName":"Tony","lName":"Chu"}';
var newUserObject = JSON.parse(newUser);
// value of newUserObject is
// {
// fName: "Tony",
// lName: "Chu"
// };