Wednesday, May 22, 2019

Tutorial 11 – Client-side development 2 - RiWAs

1. Distinguish the term “Rich Internet Applications” (RIAs) from “Rich Web-based Applications” (RiWAs). 

Definition
What does Rich Internet Application (RIA) mean?
A Rich Internet Application (RIA) is a Web application with many of the same features and appearances as a desktop application. A RIA requires a browser, browser plug-in or virtual machine to deliver a user application. Data manipulation is handled by the server, and user interface and related object manipulation are handled by the client machine


2. Discuss the key features of RiWAs, which make them more advanced than the standard applications. 

Modern day business applications use variety of programming platforms to develop web-based applications. Some applications may be developed in Java, others in .Net, while some other in Angular JS, Node.js, etc.
Most often than not, these heterogeneous applications need some sort of communication to happen between them. Since they are built using different development languages, it becomes really difficult to ensure accurate communication between applications.
Here is where web services come in. Web services provide a common platform that allows multiple applications built on various programming languages to have the ability to communicate with each other.

3. Identify different technologies and techniques used to develop the client-side components of the RiWAs, explaining their use in dedicated environments. 

Angular. Angular is one of the latest web technologies designed specifically for developing dynamic web applications.
Ruby on Rails. Ruby on Rails is a server-side website technology that makes app development much easier and faster.

  • YII.
  • Meteor JS.
  • Express.js.
  • Zend.
  • Django.
  • Laravel.


4. Explain what Delta-Communication is, discussing the advantages of using it. 

Advantages:

  • The digital communication systems are simpler and cheaper compared to analog communication systems because of the advances made in the IC technologies.
  • In digital communication, the speech, video and other data may be merged and transmitted over a common channel using multiplexing.
  • Using data encryption, only permitted receivers may be allowed to detect the transmitted data. This property is of its most importance in military applications.
  • Since the transmission is digital and the channel encoding is used, therefore the noise does not accumulate from repeater to repeater in long distance communications.
  • Since the transmitted signal is digital in nature, therefore, a large amount of noise interference may be tolerated.
  • Since in digital communication, channel coding is used, therefore, the errors may be detected and corrected in the receivers.
  • Digital communication is adaptive to other advanced branches of data processing such as digital signal processing, image processing and data compression, etc.


Disadvantages

  • Due to analog to digital conversion, the data rate becomes high. therefore more transmission bandwidth is required for digital communication.
  • Digital communication needs synchronization in case of synchronous modulation.


5. Compare and contrast synchronous and asynchronous communication in the context of DC. 

Synchronous vs. asynchronous communication

In synchronous communication multiple parties are participating at the same time and wait for replies from each other. One way to visualize the concept of synchronous communications is to imagine a real-time online chat session in which you exchange messages with a live customer support specialist to get help for your broken toaster oven.

Before message exchange in this synchronous scenario can begin, the sender and receiver must establish a communications session and agree which party is going to be in control. Once the session is established, the two-way, give-and-take conversation occurs in actual time. When you type and send a chat message, the party at the other end is present and actively waiting to receive or hear your message and then immediately respond to it. Both parties are working together at the same time with their clocks in lockstep (time zone differences notwithstanding) -- in other words, synchronized.

Asynchronous communication is different. For example, it occurs when that toaster oven manufacturer doesn't offer real-time chat, forcing you instead to send an email message to a company's tech support department. The recipient is neither expecting nor waiting for an incoming message and therefore may not get to it right away.

6. Compare and contrast different types of technologies and techniques available for DC implementation, indicating their pros and cons. 

Pro 
Technology Can Streamline Tedious Tasks
Taking attendance, tracking grades and even answering common student questions can take up a lot of a teacher’s time. Adding technology to the classroom can help eliminate some of these tasks, freeing the teacher to focus on delivering quality lessons to the class. Programs like Top Hat, for instance, allow a teacher to manage tests securely in a digital environment that automatically grades and tracks them, while also allowing greater interaction with students and collaboration in the classroom.

Technology Is a Part of Modern Life
A teacher’s goal is to develop students who are prepared for life as an adult, and today’s adult world is one that utilizes technology. The more opportunities a student has to work with technology in school, the less intimidation the student will feel when entering the workforce and trying to embrace technology in their occupation.

Technology Can Increase Student Engagement
When used well and woven through a lesson by a skilled teacher, technology can increase student engagement. One way to do this is through comprehension checks. Teachers can use tools to check students’ understanding during the lesson, allowing them to make adjustments if students are struggling to grasp a concept. Some tools that allow for this include:

Padlet ― This free tool allows students to add their responses to a classroom display that allows for comprehension checks and collaboration.
Socrative ― This free tool allows teachers to track student progress, while also providing options for using questions to check for understanding during a lesson.
Plickers ― This tool uses QR codes on cards held by students, which means it can be used even in classrooms that do not offer student devices.
In addition, teachers who use technology to present lessons can engage students more easily, because technology is a format most students are drawn to naturally.

Con 
Teachers Fear Adding More Screen Time
Today’s students are getting far more screen time then they should have. According to the Common Sense Census: Media Use by Tweens and Teens study, students ages 8 through 12 spend an average of six hours of time daily on screens for entertainment. This increases to almost nine hours for high school and upper middle school students. Adding technology in the classroom may add more screen time to that statistic. While the screens are used educationally, the overall impact of screen time on the brain is going to increase.

Technology May Not Be Utilized to the Fullest
Adding a computer to the classroom that students can play on when done with their work, use to search Google and access for word processing purposes is not using technology to the fullest in the classroom. In order for technology to be used effectively in the classroom, teachers must be trained on how to incorporate it into their lesson planning well, weaving their instruction around the use of technology.

Technology Can Be a Distraction
Students who have a tablet or computer in front of them during a lesson are going to be tempted to play instead of listening. Teachers must set clear expectations for the appropriate use of technology in order to ensure that this is not a problem.

Technology clearly has both pros and cons when used in the classroom, but the bottom line is this: We are living in a digital world, and students are interacting with technology, and possibly even bringing it with them to school, on a daily basis. The benefits of using technology in the classroom are far-reaching and need to be embraced by modern educators who seek to prepare students for adult life.

7. Discuss the history and the evolution of the XHR and AJAX. 

AJAX is a developer's dream, because you can:

  • Update a web page without reloading the page
  • Request data from a server - after the page has loaded
  • Receive data from a server - after the page has loaded
  • Send data to a server - in the background


8. Discuss the role of the DC-engine in RiWAs. 

A DC motor is any of a class of rotary electrical machines that converts direct current electrical energy into mechanical energy. A DC motor's speed can be controlled over a wide range, using either a variable supply voltage or by changing the strength of current in its field winding

Advantages of DC motors
The primary advantage of the DC motor is that it can develop constant torque over a wide speed application. Power supply is an important consideration in the application of DC motors. The most common way to provide DC voltage to a motor from an AC line is through the use of an electronic drive.

9. Explain the role of the DC-Bus, indicating how a web-service can be effectively used to implement it. 

The DC bus in a VFD has found its usage as the technology has evolved. Some of the applications of DC bus, ... Using the DC bus as a discharge medium in the case of faster braking of load. A resister connected to DC bus can act as a brake resister which dissipates surge power generated by fast decelerating load.

12. Discuss the variation of the jQuery ajax() function, explaining all the related options and events. 


The jQuery $.ajax() function is used to perform an asynchronous HTTP request. It was added to the library a long time ago, existing since version 1.0. The $.ajax()function is what every function discussed in the previously mentioned article calls behind the scene using a preset configuration. The signatures of this function are shown below:

$.ajax(url[, options])
$.ajax([options])

The url parameter is a string containing the URL you want to reach with the Ajax call, while options is an object literal containing the configuration for the Ajax request.

  • accepts: The content type sent in the request header that tells the server what kind of response it will accept in return
  • async: Set this options to false to perform a synchronous request
  • beforeSend: A pre-request callback function that can be used to modify the jqXHRobject before it is sent
  • cache: Set this options to false to force requested pages not to be cached by the browser
  • complete: A function to be called when the request finishes (after success and error callbacks are executed)
  • contents: An object that determines how the library will parse the response
  • contentType: The content type of the data sent to the server
  • context: An object to use as the context (this) of all Ajax-related callbacks
  • converters: An object containing dataType-to-dataType converters
  • crossDomain: Set this property to true to force a cross-domain request (such as JSONP) on the same domain
  • data: The data to send to the server when performing the Ajax request
  • dataFilter: A function to be used to handle the raw response data of XMLHttpRequest
  • dataType: The type of data expected back from the server
  • error: A function to be called if the request fails
  • global: Whether to trigger global Ajax event handlers for this request
  • headers: An object of additional headers to send to the server
  • ifModified: Set this option to true if you want to force the request to be successful only if the response has changed since the last request
  • isLocal: Set this option to true if you want to force jQuery to recognize the current environment as “local”

Tuesday, May 14, 2019

Tutorial 10 – Client-side development 1 - jQuery

1. Is jQuery a framework or a library? Discuss. 
jQuery: It's a library, not a framework

Is jQuery a JavaScript library?

jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.

2. Explain the features provided by jQuery? 

JQuery Features


  1. Simple and easy: It have predefined method using you can perform any task easily compare to JavaScript. And it is easy to learn.
  2. Lightweight: It is very lightweight library - about 19KB in size ( Minified and gzipped ).
  3. CSS manipulation: It have predefined css() method for manipulate style for any Html elements.
  4. Html manipulation: The jQuery made it easy to select DOM elements, traverse them and modifying their content.
  5. Cross browser support: It support all modern web-browser including IE-6.
  6. Event handling: It support event handling like click mouse button.
  7. JavaScript Library: It is JavaScript library.
  8. Ajax Support: It support ajax, you can develop a responsive and feature-rich site using AJAX technology.
  9. Built-in Animation: It have predefined method "animate()" for create custom animation on web-page


3. Discuss the advantages and disadvantages of using jQuery in different project scales.

The advantages of jQuery

The main advantage of jQuery is that it is much easier than its competitors. You can add plugins easily, translating this into a substantial saving of time and effort. In fact, one of the main reasons why Resig and his team created jQuery was to buy time (in the web development world, time matters a lot).

The open source license of jQuery allows the library to always have constant and fast support, constantly publishing updates. The jQuery community is active and extremely hardworking.

Another advantage of jQuery over its competitors such as Flash and pure CSS is its excellent integration with AJAX.


The disadvantages of jQuery

One of the main disadvantages of jQuery is the large number of published versions in the short time. It does not matter if you are running the latest version of jQuery, you will have to host the library yourself (and update it constantly), or download the library from Google (attractive, but can bring incompatibility problems with the code).

In addition to the problem of the versions, other disadvantages that we can mention:

jQuery is easy to install and learn, initially. But it’s not that easy if we compare it with CSS
If jQuery is improperly implemented as a Framework, the development environment can get out of control.

4. Explain how the jQuery handles the issues related to partial page loads to the browser. 

Load ASP.NET MVC Partial Views Dynamically Using JQuery

Most of the times ASP.NET MVC views are rendered as a result of user navigating to some action. For example, when a user navigates to /home/index in the browser (either through address bar or through a hyperlink), ASP.NET MVC executes the action method and usually returns a view to the browser. This means each view is rendered as a result of a full GET or POST request. At times, however, you may want to load views dynamically through Ajax. This way you can render contents of a view without full page refresh.

5. Discuss the selectors and their use in jQuery. 

What is a jQuery selector?
A jQuery Selector is a function which makes use of expressions to find out matching elements from a DOM based on the given criteria. Simply you can say, selectors are used to select one or more HTML elements using jQuery. Once an element is selected then we can perform various operations on that selected element.

jQuery reads selectors from right to left.
Using an exact ID is fastest, followed by using an exact tag name, because they use optimized JavaScript-native methods.
Native CSS selectors like :first-child are faster than jQuery selectors like :first .

6. Compare and contrast the use of CSS advanced selectors in jQuery and jQuery’s DOM traversal API, indicating the pros and cons of them. 

CSS advanced selectors in jQuery
jQuery selectors allow you to select and manipulate HTML element(s). jQuery selectors are used to "find" (or select) HTML elements based on their name, id, classes, types, attributes, values of attributes and much more. It's based on the existing CSS Selectors, and in addition, it has some own custom selectors.


7. Explain the importance of DOM objects and DOM processing in jQuery. 

The functions associated with these objects determine how the objects may be manipulated, and they are part of the object model. The Document Object Model currently consists of two parts, DOM Core and DOM HTML. The DOM Core represents the functionality used for XML documents, and also serves as the basis for DOM HTML.

8. Discuss the benefits of using jQuery event handling over HTML event attributes, providing a list of events supported by jQuery.

jQuery Event Methods
Event methods trigger or attach a function to an event handler for the selected elements.
The following table lists all the jQuery methods used to handle events.

Commonly Used jQuery Event Methods
click() The click() method attaches an event handler function to an HTML element.
dblclick() The dblclick() method attaches an event handler function to an HTML element.

  • mouseenter() 
  • mouseleave() 
  • mousedown() 
  • mouseup() 


 9. Explain how to declare jQuery event handlers outside the $(document).ready() function, indicating the need for that, and the related issues and solutions for them. 

What is $( document .ready function () in jquery?

Definition and Usage. The ready event occurs when the DOM (document object model) has been loaded. Because this event occurs after the document is ready, it is a good place to have all other jQuery events and functions. Like in the example above. The ready() method specifies what happens when a ready event occurs.


10. Identify a list of advanced features provided by jQuery and explain their use towards improving the user experience

1) Use the Latest Version of jQuery
With all the innovation taking place in the jQuery project, one of the easiest ways to improve the performance of your web site is to simply use the latest version of jQuery. Every release of the library introduces optimizations and bug fixes, and most of the time upgrading involves only changing a script tag.
You can even include jQuery directly from Google's servers, which provide free CDN hosting for a number of JavaScript libraries.
<!-- Include a specific version of jQuery -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>

<!-- Include the latest version in the 1.6 branch -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
The latter example will include the latest 1.6.x version automatically as it becomes available, but as pointed out on css-tricks, it is cached only for an hour, so you better not use it in production environments.

2) KEEP SELECTORS SIMPLE

Up until recently, retrieving DOM elements with jQuery was a finely choreographed combination of parsing selector strings, JavaScript loops and inbuilt APIs like getElementById()getElementsByTagName() and getElementsByClassName(). But now, all major browsers support querySelectorAll(), which understands CSS query selectors and brings a significant performance gain.
However, you should still try to optimize the way you retrieve elements. Not to mention that a lot of users still use older browsers that force jQuery into traversing the DOM tree, which is slow.
$('li[data-selected="true"] a')   // Fancy, but slow
$('li.selected a')  // Better
$('#elem')  // Best

3) JQUERY OBJECTS AS ARRAYS

The result of running a selector is a jQuery object. However, the library makes it appear as if you are working with an array by defining index elements and a length.
// Selecting all the navigation buttons:
var buttons = $('#navigation a.button');

// We can loop though the collection:
for(var i=0;i<buttons.length;i++){
    console.log(buttons[i]);    // A DOM element, not a jQuery object
}

// We can even slice it:
var firstFour = buttons.slice(0,4);
If performance is what you are after, using a simple for (or a while) loop instead of $.each(), can make your code several times faster.

4) THE SELECTOR PROPERTY

jQuery provides a property which contains the selector that was used to start the chain.
$('#container li:first-child').selector    // #container li:first-child
$('#container li').filter(':first-child').selector    // #container li.filter(:first-child)
Although the examples above target the same element, the selectors are quite different. The second one is actually invalid - you can't use it as the basis of a new jQuery object. It only shows that the filter method was used to narrow down the collection.

5) CREATE AN EMPTY JQUERY OBJECT

Creating a new jQuery object can bring significant overhead. Sometimes, you might need to create an empty object, and fill it in with the add() method later.
var container = $([]);
container.add(another_element);
This is also the basis for the quickEach() method that you can use as a faster alternative to the default each().

6) SELECT A RANDOM ELEMENT

As I mentioned above, jQuery adds its own selection filters. As with everything else in the library, you can also create your own. To do this simply add a new function to the $.expr[':'] object. One awesome use case was presented by Waldek Mastykarz on his blog: creating a selector for retrieving a random element. You can see a slightly modified version of his code below:
(function($){
    var random = 0;

    $.expr[':'].random = function(a, i, m, r) {
        if (i == 0) {
            random = Math.floor(Math.random() * r.length);
        }
        return i == random;
    };

})(jQuery);

// This is how you use it:
$('li:random').addClass('glow');

Sunday, April 28, 2019

Tutorial 09 – Introduction to client-side developmen

1. What are the main elements of client-side application components of distributed systems? 

These client-side elements 

  • Views –what users see (mainly GUIs) 
  • Controllers –contain event handers for the Views 
  • Client-model –Business logic and data



2. Discuss the Views development technologies for the browser-based client-components of web-based applications 

VIEW DEVELOPMEN

Content –HTML 

Different types of elements to define content 

  • The <!DOCTYPE html> declaration defines this document to be HTML5
  • The <html> element is the root element of an HTML page
  • The <head> element contains meta information about the document
  • The <title> element specifies a title for the document
  • The <body> element contains the visible page content
  • The <h1> element defines a large heading
  • The <p> element defines a paragraph

Structural elements

  • header, footer, nav, aside, article 
  • Text elements 
  • Headings –<h1> to <h6> 
  • Paragraph –<p> 
  • Line break -<br> 
  • Images 
  • Hyperlinks

Formatting –CSS

There are three ways of inserting a style sheet:

  • External style sheet
  • Internal style sheet
  • Inline style

Tools

  • jQuery–A JS library, but can be seen a framework too. It wraps the complexity of pure JS. There are lots of JS frameworks, libraries, and plugins built using jQuery. Good for DOM processing. 
  • jQuery UI –Focus on GUI development 
  • Bootstrap–to rapidly design and develop responsive web pages and templates 
  • Angular–a JS framework/platform to build frontend applications 
  • React–a JavaScript library for building user interfaces


3. Discuss the Controller development technologies for the browser-based client-components of web-based applications 

Model–View–Controller (usually known as MVC) is an architectural pattern commonly used for developing user interfaces that divides an application into three interconnected parts. This is done to separate internal representations of information from the ways information is presented to and accepted from the user.[1][2] The MVC design pattern decouples these major components allowing for efficient code reuse and parallel development.

Traditionally used for desktop graphical user interfaces (GUIs), this architecture has become popular for designing web applications.[3] Popular programming languages like Java, C#, Python, Ruby, PHP have MVC frameworks that are used in web application development straight out of the box.

4. Discuss the client-Model development technologies for the browser-based client components of web-based applications 

The client-server model is a core network computing concept also building functionality for email exchange and Web/database access. Web technologies and protocols built around the client-server model are: Hypertext Transfer Protocol (HTTP)

5. Explain different categories of elements in HTML, proving examples for their use 

html - <html> element...</html>
<html> is the element that begins and ends each and every web page. Its sole purpose is to hold each web element nicely in position and serves the role of book cover; all other HTML elements are encapsulated within the <html> element. The tag also lets web browsers know, "Hey, I'm an HTML web page!", so that the browser knows how to render it. Remember to close your HTML documents with the corresponding </html> tag to signify the end of the HTML document.

If you haven't already, it is time to open up Notepad, Notepad++, or Crimson Editor and have a new, blank document ready to go. Copy the following HTML code into your text editor.

HTML Element Code:
<html> 
</html>


Now save your file by selecting - Menu and then Save. Click on the Save as Type drop down box and select the option All Files. When you're asked to name your file, name it - index.html. Double-check that you did everything correctly and then press - Save. Now open your file in a new web browser so that you have the ability to refresh the page and see any new changes.

html - <head> element
The <head> is usually the first element contained inside the <html> element. While it is also an element container that encapsulates other HTML elements, these elements are not directly displayed by a web browser. Instead they function behind the scenes, providing more descriptive information about the HTML document, like its page title and other meta data. Other elements used for scripting (JavaScript) and formatting (CSS) are also contained within the <head> element, and we will eventually introduce how to utilize those languages. For now, the head element will continue to lay empty except for the title element, which will be introduced next.

Here's a sample of the initial setup.

HTML Head Element Code:
<html>
  <head>
  </head>
</html>


If you've made the code changes and refreshed the browser page, you will notice that we still have nothing happening on the page.

html - <body> element
The element that encapsulates all the visual elements (paragraphs, pictures, tables, etc.) of a web page is the <body> element. We will be looking at each of these elements in greater detail as the tutorial progresses, but for now, it's only important to understand that the body element is one of the four critical web page elements, and it contains all of the page's viewable content.

HTML Body Element Code:
<html> 
  <head>
    <title>My Web Page!</title>
  </head>
  <body>
    <p>Once upon a time...</p>
  </body>
</html>


6. Discuss the importance of CSS, indicating new features of CSS3 

1) CSS 3 Selectors
In addition to the selectors that were available in CSS2, CSS 3 introduces some new selectors. Using these selectors you can choose DOM elements based on their attributes. So you don't need to specify classes and IDs for every element. Instead, you can utilize the attribute field to style them.

The most useful attributes for selectors are:
[attr^=val] –- matches a DOM element with the attribute attr and a value starting with val
[attr$=val] –- matches a DOM element with the attribute attr and a value ending with the suffix val
[attr*=val] –- matches a DOM element with the attribute attr and a value containing the substring val

CSS
1 <div class="code"><style> 
2 p[title^="car"] {color: red;} 
3 img[src*="birth"] {border:3px solid green;} 
4 </style></div>

HTML
1 <div class="code"><img src="happy_birthdays.jpg" /> 
2 <p title="container">I am displaying a container. And this attribute won't match me. </p> 
3 <p title="carousel">This carousel will match</p></div>



2) CSS 3 Rounded Corners
Rounded corner elements can spruce up a website, but creating a rounded corner requires a designer to write a lot of code. Adjusting the height, width and positioning of these elements is a never-ending chore because any change in content can break them.

CSS 3 addresses this problem by introducing the border-radius property, which gives you the same rounded-corner effect and you don't have to write all the code. Here are examples for displaying rounded corners in different places of a website.

CSS
<div class="code">  .box{ border: 2px solid orange; border-radius : 25px; width: 100px; padding: 10px; text-align:center;  }</div>


HTML
<div class="code"><div class="box">Submit</div></div> 

OUTPUT



3) CSS 3 Border Image
Another exciting feature in CSS 3 is the ability to swap out a border with an image. The property border-image allows you to specify an image to display instead of a plain solid-colored border.

CSS
<div class="code">#col{border-image:url(border_image.png) 100 100 100 100 round round; border-width: 10px;}</div> 
view plain | print | ?


HTML
<div class="code"><div id="col">my content</div></div>


4) CSS 3 Box Shadow
A box shadow allows you to create a drop shadow for an element. Usually this effect is achieved using a repeated image around the element. However, with the property box-shadow this can be achieved by writing a single line of CSS code.

After previously removing this property from the CSS 3 Backgrounds and Borders Module, the W3C added it back in the last working draft.

CSS
<div class="code">.shadow{ background-color: #EEEEEE; box-shadow:3px 3px 3px 2px #797979; height: 50px; width: 100px; padding: 5px;}</div> 
view plain | print | ?


HTML
<div class="code"><div class="shadow">  my content </div></div>

OUTPUT

5) CSS 3 Text Shadow
The new text-shadow property allows you to add drop shadows to the text on a webpage. Prior to CSS 3, this would be done by either using an image or duplicating a text element and then positioning it. A similar property called box-shadow is also available in CSS 3.

CSS
<div class="code">p{ text-shadow: #aaa 2px 2px 2px; }</div>

HTML
<div class="code"><p>My text is more beautiful, than a normal webfont</p></div> 

OUTPUT


7. Compare and contrast the 3 main types of CSS selectors 

1) Universal Selector
The universal selector works like a wild card character, selecting all elements on a page. Every HTML page is built on content placed within HTML tags. Each set of tags represents an element on the page. Look at the following CSS example, which uses the universal selector:

* {
   color: green;
   font-size: 20px;
   line-height: 25px;
}

The three lines of code inside the curly braces (color, font-size, and line-height) will apply to all elements on the HTML page. As seen here, the universal selector is declared using an asterisk. You can also use the universal selector in combination with other selectors.

2) Element Type Selector
Also referred to simply as a “type selector,” this selector must match one or more HTML elements of the same name. Thus, a selector of nav would match all HTML nav elements, and a selector of <ul> would match all HTML unordered lists, or <ul> elements.

The following example uses an element type selector to match all <ul> elements:

ul {
   list-style: none;
   border: solid 1px #ccc;
}

To put this in some context, here’s a section of HTML to which we’ll apply the above CSS:

<ul>
  <li>Fish</li>
  <li>Apples</li>
  <li>Cheese</li>
</ul>

<div class="example">
  <p>Example paragraph text.</p>
</div>

<ul>
  <li>Water</li>
  <li>Juice</li>
  <li>Maple Syrup</li>
</ul>

There are three main elements making up this part of the page: Two <ul> elements and a <div>. The CSS will apply only to the two <ul> elements, and not to the <div>. Were we to change the element type selector to use <div> instead of <ul>, then the styles would apply to the <div> and not to the two <ul> elements.

Also note that the styles will not apply to the elements inside the <ul> or <div> elements. That being said, some of the styles may be inherited by those inner elements.

3) ID Selector
An ID selector is declared using a hash, or pound symbol (#) preceding a string of characters. The string of characters is defined by the developer. This selector matches any HTML element that has an ID attribute with the same value as that of the selector, but minus the hash symbol.

Here’s an example:

#container {
   width: 960px;
   margin: 0 auto;
}

This CSS uses an ID selector to match an HTML element such as:

<div id="container"></div>

In this case, the fact that this is a <div> element doesn’t matter—it could be any kind of HTML element. As long as it has an ID attribute with a value of container, the styles will apply.

An ID element on a web page should be unique. That is, there should only be a single element on any given page with an ID of container. This makes the ID selector quite inflexible, because the styles used in the ID selector rule set can be used only once per page.

If there happens to be more than one element on the page with the same ID, the styles will still apply, but the HTML on such a page would be invalid from a technical standpoint, so you’ll want to avoid doing this.

In addition to the problems of inflexibility, ID selectors also have the problem of very high specificity.

8. Discuss the advanced CSS selectors, explaining the specificity 

Advanced Selectors in CSS
Selectors are used for selecting the HTML elements in the attributes. Some different types of selectors are given below:

1) Adjacent Sibling Selector: 
It selects all the elements that are adjacent siblings of specified elements. It selects the second element if it immediately follows the first element.

Syntax: It select ul tags which immediately follows the h4 tag

h4+ul{ 
border: 4px solid red; 
}  

Example:

<!DOCTYPE html> 
<html> 
<head> 
<title>adjacent</title> 
<style type="text/css"> 
ul+h4{ 
border:4px solid red; 

</style> 
</head> 
<body> 
<h1>GeeksForGeeks</h1> 
<ul> 
<li>Language</li> 
<li>Concept</li> 
<li>Knowledge</li> 
</ul> 
<h4>Coding</h4> 
<h2>Time</h2> 
</body> 
</html> 

Output:




2) Attribute Selector:
It selects a particular type of inputs.

Syntax:

input[type="checkbox"]{ 
background:orange; 


Example:

<html> 
<head> 
<title>Attribute</title> 
<style type="text/css"> 
a[href="http://www.google.com"]{ 
background:yellow; 

</style> 
</head> 
<body> 
<a href="http://www.geeksforgeeks.org">geeksforgeeks.com</a><br> 
<a href="http://www.google.com" target="_blank">google.com</a><br> 
<a href="http://www.wikipedia.org" target="_top">wikipedia.org</a> 
</body> 
</html>

Output:


3) nth-of-type Selector:
It selects an element from its position and types.

Syntax: Select a particular number tag to make changes.

div:nth-of-type(5){ 
background:purple; 


If we want to make canges in all even li.

li:nth-of-type(even){ 
background: yellow; 


Example:

<html> 
<head> 
<title>nth</title> 
<style type="text/css"> 
ul:nth-of-type(2){ 
background:yellow; 

</style> 
</head> 
<body> 
<ul> 
<li>java</li> 
<li>python</li> 
<li>C++</li> 
</ul> 
<ul> 
<li>HTML</li> 
<li>CSS</li> 
<li>PHP</li> 
</ul> 
<ul> 
<li>C#</li> 
<li>R</li> 
<li>Matlab</li> 
</ul> 
</body> 
</html> 

Output:


9. Explain the use for CSS media queries in responsive web development 

Media Queries in Responsive Design
Media types first appeared in HTML4 and CSS2.1, which enabled the placement of separate CSS for screen and print. In this way, it was possible to set separate styles for a page’s computer display vis-à-vis its printout.

<link rel="stylesheet" type="text/css" href="screen.css" media="screen">
<link rel="stylesheet" type="text/css" href="print.css"  media="print">

or

@media screen {
    * {
        background: silver
    }
}

In CSS3, you can define styles depending on the page width. As page width correlates with the size of the user’s device, this capability thus allows you to define different layouts for different devices. Note: media queries are supported by all major browsers.

This definition is possible through the setting of basic properties: max-width, device-width, orientation, and color. Other definitions are possible as well; but in this, case the most important things to note are minimum resolution (width) and orientation settings (landscape vs. portrait).

The responsive CSS example below shows the procedure for initiating a certain CSS file with respect to the page width. For example, if 480px is the maximum resolution of the current device’s screen, then the styles defined in main_1.css will be applied.

<link rel="stylesheet" media="screen and (max-device-width: 480px)" href="main_1.css" />


We can also define different styles within the same CSS stylesheet such that they are only utilized if certain constraints are satisfied. For example, this portion of our responsive CSS would only be used if the current device had a width above 480px:

@media screen and (min-width: 480px) {
    div {
        float: left;
        background: red;
    }
    .......
}

10. Identify the pros and cons of 3 ways of using CSS (inline, internal, external) 

There are the following three types of CSS:

  • Inline CSS.
  • Internal CSS.
  • External CSS.
Advantages of Cascading Style Sheet (CSS) 

Saves Time 

Let’s consider an example. You run a website that has 40 pages or more. Due to the need for some strategic changes in the content of the website, you now need to change the text size from 14pt to 12pt or vice-versa. How much time do you think will it take for manually making the size changes to all those 40 pages? A lot! This is where CSS comes into the scenario as a savior. You can then define the changes in a single CSS file and reference all those 40 pages to that same file and your work will be done. Your entire website will start reflecting the size changes.

Help to Make Spontaneous and Consistent Changes 

Considering our very own example from the first advantage above, imagine that you have to make more fluid changes to your content. Again, with a single style sheet, you will be able to ensure that the changes look uniform on all the pages and not botched up. If it were not for CSS, you would have to take notes of changes made to one page and reference it while you make changes to another page, always going back and forth. Imagine the amount of exhaustion and brain activity that would be required to justify the consistency of these changes throughout. However, with CSS, your changes are well applied consistently.

Improves Page Loading Speed 

Code density on your website contributes to its speed. The more the code, the slower the website gets. FYI, visitors are quick to abandon a website if it takes more than 2-3 seconds to load.
Just a few lines of code is all that is required to make changes to a large number of pages on the website with CSS. Since there is minimal code, the website database remains uncluttered, thus, eliminating any website loading issues. Implementing CSS along with the choice of best website builders is a great way to keep visitors hooked on to your website as they won’t have to wait up for your website to load.

Device Compatibility 

CSS changes are device friendly. With people using a whole lot of different range of smart devices to access websites over the internet, there is a need for responsive web design. CSS serves the purpose here by making your web pages more responsive so that they end up displaying in the same manner on all devices.

Disadvantages of Cascading Style Sheet (CSS) 

Cross-Browser Issues 

Implementing initial CSS changes on a website is easy on the developer’s end. However, after the changes have been made, you will have to confirm the compatibility if the CSS is displaying similar change effects on all the browsers. This is simply due to the fact that CSS works differently on different browsers.
Confusion Due to Its Many Levels

The programming language world in itself is crazily complicated for non-developers and beginners. To add to that,  different levels of CSS i.e. CSS; CSS 2; CSS 3 can be quite confusing for the mentioned lot.

Vulnerable 

If you have worked with CSS, you probably know that it is easily accessible because of its open text-based system. An accident or a mere act of mischief with the files can end up disrupting the display and formatting of your entire website. It would only require a read/write access to the intended website to override the changes.


11. Identify frameworks/libraries/plugins/tools to develop the Views/web pages, and discuss their similarities and differences 

Framework

In a framework, all the control flow is already there and there are many predefined white spots that we should fill out with our code. A framework is normally more complex. It defines a skeleton where the application defines its own features to fill out the skeleton. In this way, your code will be called by the framework appropriately. The benefit is that developers do not need to worry about if a design is good or not, but just about implementing domain-specific functions. The framework will provide you with hooks and call-backs, so that you build on it; it will then call your plugged-in code whenever it wishes, a phenomenon called Inversion of Control.

A framework can contain libraries. A framework will usually include many libraries to make your work easier.

Library

A library performs specific, well-defined operations. A library is just a collection of class definitions. The reason is it simply code reuse, in other words gets the code that has already been written by other developers. The classes and methods normally define specific operations in a domain-specific area. For example, there are some libraries of mathematics that can let developers just call the function without redoing the implementation of how an algorithm works. A library will usually focus on a single piece of functionality that you access using an API. You call a library function, it executes some code and then the control is returned to your code.

Plugin

A plugin is a software add-on that is installed on a program, enhancing its capabilities. For example, if you wanted to watch a video on a website, you may need a plugin to play it because your browser doesn't have the tools it needs. You can think of it like getting a Blu-ray player for your Blu-ray disc.

Difference between a framework and a library?

The key difference between a library and a framework is "Inversion of Control". When you call a method from a library, you are in control. But with a framework, the control is inverted: the framework calls you. A library is just a collection of class definitions.

12. Discuss the client-side component development related aspects in browser-based web applications 

Components should be reusable, but they should be independent too. Every behavior must be driven by the component API, it shouldn’t be manipulated by outside. Also, components could have different variations, much like a button which can be for example, a small button, disabled, with icons etc.

Writing components is a good way to structure our client-side apps. However, we should be careful when writing and using them.

Observe an example of a <ui-button> component, and the logic that is applied to it, which can prove useful in any kind of component library or web-component

client-side app

13. Discuss the new features in JS version 6 


top 10 best ES6 features

  • Default Parameters in ES6
  • Template Literals in ES6
  • Multi-line Strings in ES6
  • Destructuring Assignment in ES6
  • Enhanced Object Literals in ES6
  • Arrow Functions in ES6
  • Promises in ES6
  • Block-Scoped Constructs Let and Const
  • Classes in ES6
  • Modules in ES6


1. Default Parameters in ES6
Remember we had to do these statements to define default parameters:

var link = function (height, color, url) {
    var height = height || 50
    var color = color || 'red'
    var url = url || 'http://azat.co'
    ...
}

They were okay until the value was 0 and because 0 is falsy in JavaScript it would default to the hard-coded value instead of becoming the value itself. Of course, who needs 0 as a value (#sarcasmfont), so we just ignored this flaw and used the logic OR anyway… No more! In ES6, we can put the default values right in the signature of the functions:

var link = function(height = 50, color = 'red', url = 'http://azat.co') {
  ...
}

2. Template Literals in ES6
Template literals or interpolation in other languages is a way to output variables in the string. So in ES5 we had to break the string like this:

var name = 'Your name is ' + first + ' ' + last + '.'
var url = 'http://localhost:3000/api/messages/' + id

Luckily, in ES6 we can use a new syntax ${NAME} inside of the back-ticked string:

var name = `Your name is ${first} ${last}.`
var url = `http://localhost:3000/api/messages/${id}`

3. Multi-line Strings in ES6
Another yummy syntactic sugar is multi-line string. In ES5, we had to use one of these approaches:

var roadPoem = 'Then took the other, as just as fair,\n\t'
    + 'And having perhaps the better claim\n\t'
    + 'Because it was grassy and wanted wear,\n\t'
    + 'Though as for that the passing there\n\t'
    + 'Had worn them really about the same,\n\t'

var fourAgreements = 'You have the right to be you.\n\

    You can only be you when you do your best.'
While in ES6, simply utilize the backticks:

var roadPoem = `Then took the other, as just as fair,
    And having perhaps the better claim
    Because it was grassy and wanted wear,
    Though as for that the passing there
    Had worn them really about the same,`

var fourAgreements = `You have the right to be you.
    You can only be you when you do your best.`


14. Identify frameworks/libraries/plugins/tools to develop the client-side components of browser-based applications, and discuss their similarities and differences 

Libraries
A library is an organized collection of useful functionality. A typical library could include functions to handle strings, dates, HTML DOM elements, events, cookies, animations, network requests, and more. Each function returns values to the calling application which can be implemented however you choose. Think of it like a selection of car components: you’re free to use any to help construct a working vehicle but you must build the engine yourself.

Libraries normally provide a higher level of abstraction which smooths over implementation details and inconsistencies. For example, Ajax can be implemented using the XMLHttpRequest API but this requires several lines of code and there are subtle differences across browsers. A library may provide a simpler ajax() function so you’re free to concentrate on higher-level business logic.

A library could cut development time by 20% because you don’t have to worry about the finer details. The downsides:

a bug within a library can be difficult to locate and fix
there’s no guarantee the development team will release a patch quickly
a patch could change the API and incur significant changes to your code.

Frameworks
A framework is an application skeleton. It requires you to approach software design in a specific way and insert your own logic at certain points. Functionality such as events, storage, and data binding are normally provided for you. Using the car analogy, a framework provides a working chassis, body, and engine. You can add, remove or tinker with some components presuming the vehicle remains operational.

A framework normally provides a higher level of abstraction than a library and can help you rapidly build the first 80% of your project. The downsides:

the last 20% can be tough going if your application moves beyond the confines of the framework
framework updates or migrations can be difficult – if not impossible
core framework code and concepts rarely age well. Developers will always discover a better way to do the same thing.

Tools
A tool aids development but is not an integral part of your project. Tools include build systems, compilers, transpilers, code minifiers, image compressors, deployment mechanisms and more.

Tools should provide an easier development process. For example, many coders prefer Sass to CSS because it provides code separation, nesting, render-time variables, loops, and functions. Browsers do not understand Sass/SCSS syntax so the code must be compiled to CSS using an appropriate tool before testing and deployment.



References
https://www.smashingmagazine.com/2018/05/future-of-web-design/
http://webreference.com/authoring/css3/index-2.html
https://www.sitepoint.com/top-javascript-frameworks-libraries-tools-use/

Tutorial 11 – Client-side development 2 - RiWAs

1. Distinguish the term “Rich Internet Applications” (RIAs) from “Rich Web-based Applications” (RiWAs).  Definition What does Rich Inter...