Skip to content

Commit

Permalink
- changed ’ to '
Browse files Browse the repository at this point in the history
- small syntax fixes
  • Loading branch information
gAmUssA committed Oct 18, 2012
1 parent d8a3f79 commit 38eb11b
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 86 deletions.
39 changes: 19 additions & 20 deletions 1_Desktop/01_html/ch1_html.asc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
== HTML5 and its New APIs

This is the first and only chapter in this book thats dedicated to
HTML5. Youll get familiar with some new HTML tags that were introduced
to make the markup more semantic and convenient. Well also provide a brief overview of
This is the first and only chapter in this book that's dedicated to
HTML5. You'll get familiar with some new HTML tags that were introduced
to make the markup more semantic and convenient. We'll also provide a brief overview of
selected APIs that are included in HTML5 spec (Web Storage, WebSQL, Web
Sockets, and Web Workers).
Sockets, and Web Workers).


The majority of the modern Web browsers already support the current
Expand All @@ -16,7 +16,7 @@ outdated browsers for some time:
1. Computer illiterate people who are afraid of installing any new
software one their PCs. Especially, people of the older generation.
_``John, after the last visit of our grandson our computer works even
slower than before. Please dont let him install these new fancy
slower than before. Please don't let him install these new fancy
browsers here. I just need my old Internet Explorer, access to Hotmail
and Facebook''_ .
2. Business users working for large corporations, where all the
Expand All @@ -32,20 +32,20 @@ denominator browser often wins.
In the worst case scenario, Web developers need to make both of these
groups happy. Take an online banking - this old couple has to be able to
use your Web application from their old PCs otherwise they can transfer
their lifetime savings to a different bank which doesnt require the
their lifetime savings to a different bank which doesn't require the
later version of Firefox for online banking.

Does it mean that enterprise Web developers shouldnt even bother using
HTML5 thats not 100% supported? Not at all. This means that a
substantial portion of their applications code will be will be bloated
Does it mean that enterprise Web developers shouldn't even bother using
HTML5 that's not 100% supported? Not at all. This means that a
substantial portion of their application's code will be will be bloated
by the if-statements figuring out what this specific Web browser
supports and providing several solutions that keep your application on
float in any Web browser. This what makes the job of DHTML developers a
lot more difficult than of, say Java developers who know exactly the
environment where their code will work. Of you dont install the
JavaRuntime of version 1.6 our application wont work. As simple as
environment where their code will work. Of you don't install the
JavaRuntime of version 1.6 our application won't work. As simple as
that. How about asking Java developers writing applications that will
work in any runtime released during the last 10 years? No, were not
work in any runtime released during the last 10 years? No, we're not
that cruel.

Do you believe it would be a good idea for Amazon or Facebook to
Expand All @@ -54,18 +54,18 @@ of their customers who will be scared to death after seeing the message
of the 20-step Java installer asking for the access to the internals of
their computer. Each author of this book is a Java developer, and we
love using Java… on the server side. But when it comes to the consumer
facing Web applications its just not there yet.
facing Web applications it's just not there yet.

So whats the bottom line? We have to learn how to develop Web
application that wont require installing any new software on the users
machines. Today its DHTML or, lets stick to the modern terminology,
So what's the bottom line? We have to learn how to develop Web
application that won't require installing any new software on the user's
machines. Today it's DHTML or, let's stick to the modern terminology,
HTML5 stack.

In the unfortunate event of needing to support both new and old HTML and
CSS implementations you can use http://html5boilerplate.com/[HTML5
Boilerplate] that is not a framework, but a template for creating a new
HTML project that will support HTML5 and CSS3 elements but will work
event in the hostile environments of the older browsers. Its like
event in the hostile environments of the older browsers. It's like
broadcasting a TV show in HD, but letting the cavemen with the 50-year
old black-and-white tubes watching it too.

Expand All @@ -88,12 +88,11 @@ In this section we'll overview a small set of the new HTML5 tags and attributes

==== HTML5 Forms: Brief Overview

It's hard to imagine an enterprise Web application that is not using forms. At the very minimum the Contact Us form has to be there. A login view is yet another example of the HTML form that almost every enterprise application needs. Our sample application Save Sick Child will need it too.
It's hard to imagine an enterprise Web application that is not using forms. At the very minimum the Contact Us form has to be there. A login view is yet another example of the HTML form that almost every enterprise application needs. Our sample application Save Sick Child will need it too.

We'll start with the prompts. Showing the hints or prompts right inside the input field will save you some screen space. HTML5 has a special attribute +placeholder+.
We'll start with the prompts. Showing the hints or prompts right inside the input field will save you some screen space. HTML5 has a special attribute +placeholder+.


=== HTML5 New APIs


TODO
68 changes: 34 additions & 34 deletions 1_Desktop/02_JavaScript/ch2_advancedjs.asc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This chapter is dedicated to the JavaScript programming language. Our
challenging goal is ``From Zero to Hero in 50 pages''. While in the
future chapters youll see how JavaScript frameworks can greatly
future chapters you'll see how JavaScript frameworks can greatly
minimize the amount of the JavaScript code that you need to write
manually, you still need to understand the language itself. At least you
should be able to read JavaScript code. This chapter starts with basics
Expand All @@ -14,7 +14,7 @@ or ``JavaScript: The Definite Guide'', Sixth Edition by David Flanagan.
Besides the JavaScript coverage this chapter includes an important
section on the tools (IDEs, debuggers, Web inspectors et al) that will
make your development process more productive. By the end of this
chapter well create the first implementation of the Web site Save a
chapter we'll create the first implementation of the Web site Save a
Child designed in Chapter 2. This version of the Web site will include
some JavaScript code. All the data for this this Web site will be stored
in a plain text format in local files.
Expand All @@ -33,14 +33,14 @@ implementation of this standard. ActionScript is a good example of
another popular dialect of ECMAScript.

To learn more about the history of JavaScript from the source watch the
Brendan Eichs presentation
Brendan Eich's presentation
http://www.youtube.com/watch?v=Rj49rmc01Hs[``JavaScript at 17''] at
OReillys conference Fluent 2012. Although the vast majority of todays
O'Reilly's conference Fluent 2012. Although the vast majority of today's
JavaScript code is being executed by the Web browsers some third-party
tools also include JavaScript engines and Googles V8 engine is a place
tools also include JavaScript engines and Google's V8 engine is a place
to run JavaScript on the server. The server-side JavaScript framework
node.js is getting popularity. Using the same programming language on
the client and the server is the main selling point of node.js. Oracles
the client and the server is the main selling point of node.js. Oracle's
Java SE 8 will include the new JavaScript engine Nashorn that can run on
both – the server and the client computers.

Expand All @@ -50,27 +50,27 @@ the techniques known as AJAX (described in Chapter 4) made a significant
impact to the way Web pages were built allowing updating the information
inside the Web page without the need to make a full page refresh. Even
though AJAX saved JavaScript, the vendors of Web browsers were no eager
to implement the latest specifications of ECMAScript. Browsers
to implement the latest specifications of ECMAScript. Browsers'
incompatibility and lack of good development tools continued preventing
JavaScript to become the language of choice for Web applications. Lets
JavaScript to become the language of choice for Web applications. Let's
not forget about the ubiquitous Flash Player – an excellent VM supported
by all Web browsers. Rich Internet Applications written in ActionScript
were compiled into the byte code and executed by Flash Player on the
users machine.
user's machine.

If AJAX saved JavaScript, then rapid proliferation of tablets and
smartphones made it really hot. Mobile devices come with modern Web
browsers and there is no need to make sure that your Web application
will work in the 11 year old Internet Explorer 6. The fact that Flash
Player wont be supported in the mobile Web browsers is yet another
Player won't be supported in the mobile Web browsers is yet another
reason to turn to JavaScript if your Web application has to be accessed
from smartphones or tablets. The ECMASript, 5th Edition has been
published in 2009 and is currently supported by most of the modern Web
browsers. If you are interested in discovering if specific features of
ECMAScript 5 are supported by a particular Web browser, check the latest
version of the http://kangax.github.com/es5-compat-table/#[ECMAScript 5
compatibility table]. At the time of this writing it looks as follows
(its a snapshot of the Chrome Browser v. 21):
(it's a snapshot of the Chrome Browser v. 21):

JavaScript became the lowest common denominator available on thousands
of different devices. Yes, the JavaScript engines are not 100%
Expand All @@ -81,26 +81,26 @@ spare you from worrying about this.
=== JavaScript Basics

JavaScript is an interpreted language that arrives to the place of
execution as text. If its a part of the Web page, the browser will load
execution as text. If it's a part of the Web page, the browser will load
and execute the JavaScript code embedded between the tags `<script>` and
`</script>` or linked from external files. The modern browsers (except
Internet Explorer 8 and older) will also automatically perform the Just
In Time (JIT) compilation of the JavaScript into machine code.
JavaScript was originally created for Web browsers, which were supposed
to show/use whatever content has successfully arrived. What if an image
has not arrived from the server? Youll see a broken image icon. What if
not all JavaScript code has arrived to the browser? Well, itll try to
has not arrived from the server? You'll see a broken image icon. What if
not all JavaScript code has arrived to the browser? Well, it'll try to
execute whatever has arrived. The end users may appreciate such
forgiveness, but the software developers should be ready to spend more
time debugging runtime errors that could have been caught by compilers
in other programming languages. JavaScript is a weakly typed language
hence the developers dont have a luxury of strong compilers help that
hence the developers don't have a luxury of strong compiler's help that
Java or C# developers enjoy. This is easily explainable. Imaging that if
in Java or C# instead of declaring variables of specific data types
everything would be of type Object and you could assign to it any value
– a string, a number, or a custom object Person. This would
substantially complicate the ability of the compiler to weed out all
possible errors. You dont need to declare variables in JavaScript –
possible errors. You don't need to declare variables in JavaScript –
just assign a value and the JavaScript engine will figure out the proper
type during the execution of your code. For example, the variable named
girlfriend will have a data type of String:
Expand All @@ -109,7 +109,7 @@ girlfriend will have a data type of String:
girlfriendName=“Mary”;
----

Since I havent use the keyword var in front of girlfriend this variable
Since I haven't use the keyword var in front of girlfriend this variable
will have the global scope. Variables declared with var inside functions
are local. Consider the following function declaration:

Expand All @@ -126,12 +126,12 @@ function addPersonalInfo(){
The variables address and isMarried are visible only inside the function
+addPersonalInfo()+. The variable age becomes global because of omission
of the keyword var. The variable isMarried changes its type from Boolean
to String during the execution and JavaScript engine wont complain
assuming that the programmer knows what shes doing. So be ready for the
to String during the execution and JavaScript engine won't complain
assuming that the programmer knows what she's doing. So be ready for the
run-time surprises and allocate a lot more time for testing comparing to
compiled languages. Yet another moving part is the JavaScript engine
where your code will run. Unless you are developing for strictly
controlled enterprise environment you cant assume that the end-user
controlled enterprise environment you can't assume that the end-user
will have the same runtime as yours. This is yet another reason to test
your code in multiple Web browsers.

Expand All @@ -152,18 +152,18 @@ If you are coming from the Java background, the chances are that you are
familiar with free and open source Eclipse IDE. In this case you can
consider either use http://www.eclipse.org/downloads[Eclipse for Java EE
developers] or http://aptana.com[Aptana Studio 3 IDE]. Aptana Studio is
available free of charge. Its Eclipse-based IDE for JavaScript
available free of charge. It's Eclipse-based IDE for JavaScript
developers. Aptana Studio comes with embedded Web Server so you can test
your JavaScript code without the need to start any additional software.
In this and the following chapter well use Aptana Studio IDE to
In this and the following chapter we'll use Aptana Studio IDE to
illustrate the features of JavaScript and start working on the prototype
of the Web application Save a Child.

For the real world development we recommend using a commercial
http://www.jetbrains.com/webstorm[IDE WebStorm] from JetBrains. In
addition to smart context sensitive help, auto-complete, and syntax
highlighting it offers HTML5 templates, a code coverage feature for unit
testing that identifies the code fragment that havent been tested. All
testing that identifies the code fragment that haven't been tested. All
of the editors and IDEs listed here are either available for free or are
priced in the area of $60 USD.Try them all and pick the one that best
fits your coding habits.
Expand All @@ -175,8 +175,8 @@ Download and install Aptana Studio 3 from
http://aptana.com[http://aptana.com]. Start Aptana and customize the
color theme of this IDE by clicking the rainbow-colored circle on its
toolbar. Since the author of this book are accustomed to Eclise IDE we
select the theme thats called Eclipse. After the initial installed of
Aptana youll see the message that on the left that reads ``There are no
select the theme that's called Eclipse. After the initial installed of
Aptana you'll see the message that on the left that reads ``There are no
projects in your workspace. To get started, please create or import an
existing one.'' Just press the button Create Project located right under
this message. You could have also created a new Web Project using the
Expand All @@ -188,10 +188,10 @@ JavaScript in the Web Browser
After learning all these facts and techniques about the language you
might be eager to see «the real use of JavaScript» – manipulating HTML
elements of Web pages, which most of the people use JavaScript for. This
is correct, at least today. In this section well be doing exactly this
is correct, at least today. In this section we'll be doing exactly this
– applying JavaScript code to HTML elements.

First lets consider the operations we need to be able to perform inside
First let's consider the operations we need to be able to perform inside
the Web page: - Programmatically finding the required element by id,
type, or a CSS class. - Changing styles of the elements (show, hide,
apply fonts and colors et al.) - Processing events that may happen to
Expand All @@ -200,10 +200,10 @@ HTML elements from the page or changing their contents - Communicating
with the server side, e.g. form submission or making AJAX requests to
request some data from the server

Youll need to understand how to perform these operations from
JavaScript. Even if youll be using one of the popular frameworks,
youll be performing the same operations applying the syntax prescribed
by your framework of choice. So lets get started.
You'll need to understand how to perform these operations from
JavaScript. Even if you'll be using one of the popular frameworks,
you'll be performing the same operations applying the syntax prescribed
by your framework of choice. So let's get started.

Styling Web Pages with CSS
~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -213,7 +213,7 @@ CSS specifications reached the level of Recommendation by W3C: CSS Level
1, 2, and 2.1. The latest CSS Level 3 (a.k.a. CSS3) adds new features to
CSS 2.1 module by module, which are listed at
http://www.w3.org/Style/CSS/current-work[http://www.w3.org/Style/CSS/current-work].
In this book well be using only the modules Fonts, Media Queries, and
In this book we'll be using only the modules Fonts, Media Queries, and
Backgrounds and Borders. Brief CSS tutorial and reference is located at
http://www.w3schools.com/cssref/default.asp

Expand All @@ -227,7 +227,7 @@ the folder css add the following tag to HTML:

The `<link>` tag allows specifying the media where specific css file has
to be used. For example, you can have one CSS file for smartphones and
another one for tablets. Well discuss this in detail in the section on
another one for tablets. We'll discuss this in detail in the section on
media queries in Chapter 11.

You should put this tag in the
Expand All @@ -244,7 +244,7 @@ include styles located elsewhere:
</style>
----

Whats the best way of including CSS in HTML? From one hand, keeping CSS
What's the best way of including CSS in HTML? From one hand, keeping CSS
in multiple files separately form HTML and JavaScript makes the code
more readable and reusable. On the other hand, when if your Web site has
consists of many files, the Web browser will have to make multiple
Expand Down
Loading

0 comments on commit 38eb11b

Please sign in to comment.