Tuesday, May 14, 2019

Tutorial 09 – Client-side development 1 - jQuery

PROGRAMMING APPLICATIONS AND FRAMEWORKS                                              
Tutorial 09


1. Is jQuery a framework or a library? 

A framework is something that usually forces a certain way of implementing a solution, whereas jQuery is just a tool to make implementing what you want to do easier. jQuery: The Write Less, Do More, JavaScript Library. For sure, it's a javascript library. ... And jQuery is just a single library 
Then jQuery is not a framework.


2. Explain the features provided by jQuery? 

•Reveal GUI elements
 •Change content (based on users’ actions) 
•Change CSS 
•Delta-Communication (Ajax)




jQuery simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is a JavaScript toolkit designed to simplify various tasks by writing less code. Here is the list of important core feature supported by jQuery 





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. ... Another advantage of jQuery over its competitors such as Flash and pure CSS is its excellent integration with AJAX

Advantages:
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
Disadvantages:

One of the main disadvantages of jQuery is a large number of published versions in a 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. 

Through an extraordinary amount of hard work, jQuery effectively provides cross-browser compatibility for DOM traversal and manipulation, Event handling and delegation, XHR/Ajax logic, Element selection and document queries, Element attribute, and data management, as well as simple object management utilities. It does so without modifying the browser's native javascript implementation by providing a comprehensive abstraction layer.

5. Discuss the selectors and their use in jQuery. 

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 selecting one or more HTML elements using jQuery

jQuery selectors enable you to find DOM elements on the web page. ... XQuery includes various selector patterns e.g element name, #id, attributes, descendant elements, CSS class, input types, etc.


jQuery can use CSS selectors
 Additionally, provides advanced selectors to access elements faster and efficiently



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. 




jQuery provides API to traverse through the DOM 
These DOM navigating APIs are faster than advanced CSS like selectors

Can navigate through the DOM, element by element
Can use DOM element objects

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

Introduction. The Document Object Model (DOM) is a programming API for HTML and XML documents. It defines the logical structure of documents and the way a document is accessed and manipulated. ... Nevertheless, XML presents this data as documents, and the DOM may be used to manage this data

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



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. 

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. 

•(this) object refers to the current object within the scope 
•Inside event handlers, (this) refers to the element, the event has triggered on

Data attributes


Refactoring with DOM objects

Target on specific elements with generic names


Filters

CSS manipulation

Animation


Tutorial 08 – Introduction to client-side development

PROGRAMMING APPLICATIONS AND FRAMEWORKS                                              
Tutorial 08


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


•Distributed systems use client-side elements for users to interact with •These client-side elements include 
       •Views – what users see (mainly GUIs) 
       •Controllers – contain event handlers 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 
•Content – HTML
• Formatting – CSS

3. Discuss the Controller development technologies for the browser-based client-components of web-based applications 
HTML, CSS, JavaScript and server-side technologies such as PHP, ASP,.Net, C#, Python, etc. 
as well as a database to store and retrieve information from 
(MySQL, Oracle, SQL 



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

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

  • Block Elements. Block elements appear on the screen as if they have a linebreak before and after them. ...
  • Inline Elements. ...
  • Grouping HTML Elements. ...
  • The <div> tag. ...
  • The <span> tag
  • A text header, denoted using the <h1> , <h2> , <h3> , <h4> , <h5> , <h6> tags.
  • A paragraph, denoted using the <p> tag.
  • A horizontal ruler, denoted using the <hr> tag.
  • A link, denoted using the <a> (anchor) tag.
  • •Structural elements
  • • header, footer, nav, aside, article


Text elements
  •  Headings
  •  Paragraph –
  •  Line break -
  • Images
  • Hyperlinks

Data representational elements (these elements use
nested structures)
  • • Lists
  • • Tables
  • • Form elements
  • • Input
  • • Radio buttons, checkboxes
  • • Buttons

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

Cascading Style Sheets or CSS are an important way to control how your Web pages look. CSS can control the fonts, text, colors, backgrounds, margins, and layout. But it can be very difficult to learn CSS, and some people would rather not learn it.


Used to
• Decorate / Format content
•Advantages
• Reduce HTML formatting tags
• Easy modification
• Save a lot of work and time
• Faster loading

Some formatting categories
Positioning
Size
Alignment
Font / Text

Color / Background / Border


7. Compare and contrast the 3 main types of CSS selectors 
•Element selector
•ID selector
•Class selector


8. Discuss the advanced CSS selectors, explaining the specificity 

CSS is one of the most powerful tools that are available to web designers (if not the most powerful). With it, we can completely transform the look of a website in just a couple of minutes, and without even having to touch the markup. But despite the fact that we are all well aware of its usefulness, CSS selectors are still not used to their full potential and we sometimes have the tendency to litter our HTML with excessive and unnecessary classes and ids, divs and spans.

9. Explain the use for CSS media queries in responsive web development 
Media query is a CSS technique introduced in CSS3.
It uses the rule@media to include a block of CSS properties only if a certain condition is true.

example:

   @media only screen and (max-width: 600px) {
  body {
    background-color: lightblue;
  
}
}


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

Internal CSS
 Advantages of Internal CSS:
  • Only one page is affected by stylesheet.
  • Classes and IDs can be used by internal stylesheet.
  • There is no need to upload multiple files. HTML and CSS can be in the same file.
Disadvantages of Internal CSS:
  • Increased page loading time.
  • It affects only one page – not useful if you want to use the same CSS on multiple documents
External CSS
 Advantages of External CSS:
  • The smaller size of HTML pages and cleaner structure.
  • Faster loading speed.
  • Same .css file can be used on multiple pages.
Disadvantages of External CSS:
  • Until external CSS is loaded, the page may not be rendered correctly.
Inline CSS
Advantages of Inline CSS:
  • Useful if you want to test and preview changes.
  • Useful for quick-fixes.
  • Lower HTTP requests.
Disadvantages of Inline CSS:
  • Inline CSS must be applied to every element

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

They dynamically generate HTML+CSS code
 •In server and/or client-side 
 •May have JS-based advanced interactive features
 • 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 (and
  the application, which uses that UI)

Pros:
  • small distribution size
  • the shallow learning curve, considerable online help
  • concise syntax
  • easy to extend
Cons:
  • adds a speed overhead to native APIs
  • less essential now that browser compatibility has improved
  • usage has flat-lined
  • some industry backlash against the unnecessary use
12. Discuss the client-side component development related aspects in browser-based web applications 

•Browser-based clients’ components comprise two main aspects
 •Controllers
 •Client-model

 •The components of browser-based clients are developed using JS/JS-based frameworks, libraries, and plugins.


Main features of the client-side component
development tools
•DOM processing (dynamic content generation, change, removal)
•Data processing
•Data persistence
•Session management (cookies)
•Communicating (with server components)


13. Discuss the new features in JS version 6 

  • JavaScript let
  • JavaScript const
  • Exponentiation (**) (EcmaScript 2016)
  • Default parameter values
  • Array.find()
  • Array.findIndex()

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

Friday, April 12, 2019

Tutorial 07 – Data Persistence

PROGRAMMING APPLICATIONS AND FRAMEWORKS                                              
Tutorial 07





01. Discuss the role of data in information systems indicating the need for data persistence 

An information system (IS) is a set of components that work together to manage data processing and storage. Its role is to support the key aspects of running an organization, such as communication, record-keeping, decision making, data analysis and more. Companies use this information to improve their business operations, make strategic decisions and gain a competitive edge.

All information systems require the input of data in order to perform organizational activities. Data, as described by Stair and Reynolds (2006), is made up of raw facts such as employee information, wages, and hours worked, barcode numbers, tracking numbers or sale numbers. The scope of data collected depends on what information needs to be extrapolated for maximum efficiency.


02. Explain the terms: Data, Database, Database Server, and Database Management System 

  • What is Data?

In simple words data can be facts related to any object in consideration. For example your name, age, height, weight, etc are some data related to you. A picture , image , file , pdf etc can also be considered data.

  • What is a Database?

Database is a systematic collection of data. Databases support storage and  manipulation of data. Databases make data management easy. Let's discuss few examples.
An online telephone directory would definitely use database to store data pertaining to people, phone numbers, other contact details, etc.
Your electricity service provider is obviously using a database to manage billing , client related issues, to handle fault data, etc.
Let's also consider the facebook. It needs to store, manipulate and present data related to members, their friends, member activities, messages, advertisements and lot more.
We can provide countless number of examples for usage of databases.

  • What does Database Server mean?

The term database server may refer to both hardware and software used to run a database, according to the context. As software, a database server is the back-end portion of a database application, following the traditional client-server model. This back-end portion is sometimes called the instance. It may also refer to the physical computer used to host the database. When mentioned in this context, the database server is typically a dedicated higher-end computer that hosts the database.
Note that the database server is independent of the database architecture. Relational databases, flat files, non-relational databases: all these architectures can be accommodated on database servers.


03. Compare Files and Databases, discussing pros and cons of them 

File System
File is a collection of related records stored on a storage medium such as a hard disk or optical disc
Let’s see some pros and cons involved in saving files in the file system.

Pros of the File System

  • Performance can be better than when you do it in a database. To justify this, if you store large files in DB, then it may slow down the performance because a simple query to retrieve the list of files or filename will also load the file data if you used Select * in your query. In a files ystem, accessing a file is quite simple and light weight.
  • Saving the files and downloading them in the file system is much simpler than it is in a database since a simple "Save As" function will help you out. Downloading can be done by addressing a URL with the location of the saved file.
  • Migrating the data is an easy process. You can just copy and paste the folder to your desired destination while ensuring that write permissions are provided to your destination.
  • It's cost effective in most cases to expand your web server rather than pay for certain databases.
  • It's easy to migrate it to cloud storage i.e. Amazon S3, CDNs, etc. in the future.

Cons of the File System


  • Loosely packed. There are no ACID (Atomicity, Consistency, Isolation, Durability) operations in relational mapping, which means there is no guarantee. Consider a scenario in which your files are deleted from the location manually or by some hacking dudes. You might not know whether the file exists or not. Painful, right?
  • Low security. Since your files can be saved in a folder where you should have provided write permissions, it is prone to safety issues and invites trouble, like hacking. It's best to avoid saving in the file system if you cannot afford to compromise in terms of security.

Database

Database is a collection of data organized in a manner that allows access, retrieval, and use of that data, Let’s see some pros and cons involved in saving files in the

Pros of Database

  • ACID consistency, which includes a rollback of an update that is complicated when files are stored outside the database.
  • Files will be in sync with the database and cannot be orphaned, which gives you the upper hand in tracking transactions.
  • Backups automatically include file binaries.
  • It's more secure than saving in a file system.

Cons of Database

  • You may have to convert the files to blob in order to store them in the database.
  • Database backups will be more hefty and heavy.
  • Memory is ineffective. Often, RDBMSs are RAM-driven, so all data has to go to RAM first. Yeah, that’s right. Have you ever thought about what happens when an RDBMS has to find and sort data? RDBMS tracks each data page — even the lowest amount of data read and written — and it has to track if it’s in-memory or if it’s on-disk, if it’s indexed or if it's sorted physically etc.

04. Discuss different arrangements of data, giving examples for each 

Structured data usually resides in relational databases (RDBMS). Fields store length-delineated data phone numbers, Social Security numbers, or ZIP codes. Even text strings of variable length like names are contained in records, making it a simple matter to search. Data may be human- or machine-generated as long as the data is created within an RDBMS structure. This format is eminently searchable both with human generated queries and via algorithms using type of data and field names, such as alphabetical or numeric, currency or date.

Unstructured data is essentially everything else. Unstructured data has internal structure but is not structured via pre-defined data models or schema. It may be textual or non-textual, and human- or machine-generated. It may also be stored within a non-relational database like NoSQL.


05. Explain different types of databases, providing examples for their use 


Relational Database
The relational database is the most common and widely used database out of all. A relational database stores different data in the form of a data table.
Operational Database
Operational database, which has garnered huge popularity from different organizations, generally includes customer database, inventory database, and personal database.
Data Warehouse
There are many organizations that need to keep all their important data for a long span of time. This is where the importance of the data warehouse comes into play.
Distributed Database
As its name suggests, the distributed databases are meant for those organizations that have different workplace venues and need to have different databases for each location.
End-user Database

To meet the needs of the end-users of an organization, the end-user database is used.
Hierarchical Databases
In a hierarchical database management systems (hierarchical DBMSs) model, data is stored in a parent-children relationship nodes. In a hierarchical database, besides actual data, records also contain information about their groups of parent/child relationships.

Network Databases
Network database management systems (Network DBMSs) use a network structure to create relationship between entities. Network databases are mainly used on a large digital computers. Network databases are hierarchical databases but unlike hierarchical databases where one node can have one parent only, a network node can have relationship with multiple entities. A network database looks more like a cobweb or interconnected network of records.


06. Compare and contrast data warehouse with Big data 

Data warehousing is one of the common words for last 10-20 years, whereas big data is a hot trend for last 5-10 years. Both of them hold a lot of data, used for reporting, managed by an electronic storage device. So one common thought of maximum people that recent big data will replace old data warehousing very soon. But still, big data and data warehousing is not interchangeable as they used totally for a different purpose. So let us start learning Big Data and Data Warehouse in a detail in this post.



Data Warehouse
          Big Data
Meaning
Mainly an architecture not a technology. It extracting data from varieties SQL based data source and help for generating analytic reports. In terms of definition, data repository, which using for any analytic reports, has been generated from one process, which is nothing but the data warehouse
 Big Data is mainly a technology, which stands on volume, velocity, and variety of the data. Volumes defines the amount of data coming from different sources, velocity refers to the speed of data processing, and varieties refers to the number of types of data
preferences
Organization wants to know some informed decision, they prefer to choose data warehousing, as for this kind of report they need reliable or believable data from the sources
If organization need to compare with lot of big data, which contain valuable information and help them to take better decision, more profitability, more customers, they obviously preferred big data approach.
Accepted data source
Accepted one or more homogeneous or heterogeneous data source
Accepted any kind of sources, including business transactions, social media and information from sensor or machine specific data.  It can come from DBMS product or not
Accepted type of formats
Handle mainly structural data
Accepted all types of formats. Structure data, relational data, and unstructured data including text documents, email, video, audio, stock ticker data and financial transaction
Subject Oriented
Data warehouse is subject oriented because it provides information on specific subject not on organization ongoing operation. It mainly focusses on analysis or displaying data which help on decision making.
Big data is also subject oriented, main different is source of data, as big data can accept and process data from all the sources including social media, sensor or machine specific data. It also main on provide exact analysis on data specifically on subject oriented
Distributed file system
Processing of huge data in data warehousing is really time consuming and sometimes it taken entire day for complete the process.
This is one of the big utility of big data. HDFS mainly defined to load huge data in distributed systems by using map reduce program




07. Explain how the application components communicate with files and databases 

  • File – File path, URL
    • Using file path or URL we can access to some particular resources and add or modify using application/ Software.
  • DB – connection string
    • We have to establish the connection string prior to connect to database. After successfully establish connection between Database and application. We can use any functionality to data in Database.

08. Differentiate the SQL statements, Prepared statements, and Callable statements 

SQL Statements
Execute standard SQL statements from the application

                         Statement stmt = con.createStatement();
                         stmt.executeUpdate(“update STUDENT set NAME =” +
                         name +
                         “ where ID =” +
                         id + “)”;



Prepared statements
The query only needs to be parsed (or prepared) once, but can be executed multiple times with the same or different parameters.
                         PreparedStatement pstmt = con.prepareStatement("update STUDENT set NAME = ?
                         where ID = ?");
                         pstmt.setString(1, "MyName");
                         pstmt.setInt(2, 111);
                         pstmt.executeUpdate();

Callable statements
Execute stored procedures
                         CallableStatement cstmt = con.prepareCall("{call
                         anyProcedure(?, ?, ?)}");
                         cstmt.execute();



09. Argue the need for ORM, explaining the development with and without ORM 

Object-relational mapping (ORM) is a mechanism that makes it possible to address, access and manipulate objects without having to consider how those objects relate to their data sources. 
PROS
  • Facilitates implementing domain model pattern.
  • Huge reduction in code.
  • Takes care of vendor specific code by itself.
  • Cache Management — Entities are cached in memory thereby reducing load on the DB.
CONS
  • Increased startup time due to metadata preparation( not good for desktop applications).
  • Huge learning curve without ORM.
  • Relatively hard to fine tune and debug generated SQL.Not suitable for applications without a clean domain object model.
10. Discuss the POJO, Java Beans, and JPA, indicating their similarities and differences 
JPA
  • it is EJB 3.0-compliant;
  • it is light-weight;
  • it manages persistent data in concert with a JPA entity manager;
  • it performs complex business logic;
  • it potentially uses several dependent Java objects;
  • it can be uniquely identified by a primary key.
POJO
  • It doesn’t have special restrictions other than those forced by Java language.
  • It doesn’t provide much control on members.
  • It can implement Serializable interface.
  • Fields can be accessed by their names.
  • Fields can have any visiblity.
  • There can be a no-arg constructor.
  • It is used when you don’t want to give restriction on your members and give user complete access of your entity
JAVA BEAN
  • It is a special POJO which have some restrictions.
  • It provides complete control on members.
  • It should implement serializable interface.
  • Fields are accessed only by getters and setters.
  • Fields have only private visiblity.
  • It must have a no-arg constructor.
  • It is used when you want to provide user your entity but only some part of your entity.
11. Identify the ORM tools available for different development platforms (Java, PHP, and .Net) 


  • PHP :- CakePHP, CodeIgniter,Doctrine, FuelPHP
  • Python :- Django,SQLAlchemy, SQLObject, Storm
  • C++ :- ODB, QxOrm
  • Java :- ActiveJDBC, ActiveJPA, Apache Cayenne, Apache Gora, Athena Framework, Carbonado
  • .NET :- Base One Foundation Component Library, DatabaseObjects, DataObjects.NET, Dapper, ECO, Entity Framework

12. Discuss the need for NoSQL indicating the benefits, also explain different types of NoSQL databases

Benifits
  • Schemaless data representation
  • Development time
  • Speed
  • Plan ahead for scalability
NoSQL Database Management Systems
  • MongoDB
  • Redis
  • Couch DB
  • RavenDB
  • MemcacheDB
  • Riak
  • Neo4j
13. Discuss what Hadoop is, explaining the core concepts of it 

Hadoop is the open source project which takes care of all the above points for distributed computing. It is completely based on the concept of Google File System and MapReduce. 

14. Explain the concept of IR, identifying tools for IR

Information retrieval, as the name implies, concerns the retrieving of relevant information from databases. It is basically concerned with facilitating the user's access to large amounts of (predominantly textual) information. The process of information retrieval involves the following stages:
  1. Representing Collections of Documents - how to represent, identify and process the collection of documents.
  2. User-initiated querying - understanding and processing of the queries.
  3. Retrieval of the appropriate documents - the searching mechanism used to obtain and retrieve the relevant documents
Tools
  • Apache Solr
  • elasticsearch
  • Algolia
  • Sphinx (search engine)
  • Site Search 360
  • OpenSearchServer
  • Xapian
  • Manticore search



References

Q1
lecture 08

Q2
https://www.toolsqa.com/sql/data-database-and-database-management-system/

Q3
https://dzone.com/articles/which-is-better-saving-files-in-database-or-in-fil


Q5
https://www.quora.com/What-are-the-different-types-of-databases

Q6
https://www.educba.com/big-data-vs-data-warehouse/

Q7
https://www.oreilly.com/library/view/web-database-applications/0596005431/ch01.html

Q8
https://javaconceptoftheday.com/statement-vs-preparedstatement-vs-callablestatement-in-java/

Q9
https://medium.com/building-the-system/dont-be-a-sucker-and-stop-using-orms-190add65add4

Tutorial 10 – Client-side development 2 - RiWAs

PROGRAMMING APPLICATIONS AND FRAMEWORKS                                                  Tutorial 10 Distinguish the term “Rich Internet...