Saturday, 16 May 2015

HTML6

                        HTML6


Introduction

HTML5 was a great leap forward for web developers. It gave us all kinds of hip new tags like <header>, <nav>and <footer>. It also gave us slick new JavaScript APIs like drag and drop, localStorage, and geolocation. Still, however, there is a void that HTML5 has yet to fill and that void is truly semantic markup.
Imagine being able to mark something up the way you want to mark it up. Imagine changing <div id="wrapper"> to <wrapper> or a better example, making a calendar like:
<calendar>
  <month name="January">
    <day>1</day>
    <day>2</day>
    <day>3</day>
    <!-- ...and so on -->
  </month>
</calendar>
Even better yet, how about finally adding support for new types of media by simply changing the media type rather than having to come up with whole new tags for it like <img>, <embed>, <video>, <audio>, and so on? For example, wouldn't it be nice to just simply do: <html:media src="my-audio-file.aac" type="aac"> and let the browser deal with how to render it?
The web is moving towards a giant app store and we need to embrace it. The markup we use shouldn't work against us, it should work for us. This spec is to do just that. To finally break free of fatuous rules and standards and to give us, developers, total freedom to code as we please bringing the web a more semantic, clean, and human readable markup.
The Concept
HTML6 is conceptually HTML with XML like namespaces. If you don't know XML, or don't know what XML namespaces are they're basically a way to allow you to use the same tag without it conflicting with a different tag. You've probably actually seen one before in the XHTML DOCTYPE:xmlns:xhtml="http://www.w3.org/1999/xhtml"
In HTML6 we take advantage of this ingenious concept by giving us freedom to use whatever tag we want by the W3C reserving namespaces and not tags. The W3C would basically reserve the right to all namespaces, and each namespace they reserve will trigger a different HTML API.
So, what does this look like? Below is an example of a full HTML6 document. We'll go over each tag and attributes in the API section.
<!DOCTYPE html>
<html:html>
    <html:head>
        <html:title>HTML6 Sample</html:title>
        <html:meta type="title" value="Page Title">
        <html:meta type="description" value="This is an example of HTML with namespaces">
        <html:link src="css/main.css" title="Main Styles" type="text/css">
        <html:link src="js/main.js" title="Main Script" type="text/javascript">
    </html:head>
    <html:body>
        <header>
            <logo>
                <html:media type="image" src="images/logo.png">
            </logo>
            <nav>
               <html:a href="/cats">Cats</a>
               <html:a href="/dogs">Dogs</a>
               <html:a href="/rain">Rain</a>
            </nav>
        </header>
        <content>
            <article>
                <h1>This is my main article head</h1>
                <h2>This is my sub head</h2>
                <p>[...]</p>
                <p>[...]</p>
            </article>
            <article>
                <h1>A cool video!</h1>
                <h2>Pay attetion to the media elements</h2>
                <p>[...]</p>
                <html:media type="video" src="vids/funny-cat.mp4" autostart controls>
                <p>Man, that was a stupid cat.</p>
            </article>
        </content>
        <footer>
            <copyright>This site is &copy; to Oscar Godson 2009</copyright>
        </footer>
    </html:body>
</html:html>
As you'll see, there are some weird <html:x> tags throughout this sample. Those are the namespaced elements that belong to the W3C and HTML6 spec. These elements trigger browser events. For example, the<html:media type="image"> element will make an image appear or, the <html:title> element makes the title bar of the browser change and so on.
All those other elements are just for you. None of those elements mean anything to the browser. They're simply hooks for CSS and JS and to make your code more semantic. The HTML elements you see in there like<p> or the <h1> tags are just because I like using those as ways to markup paragraphs or the most important header, but I could have used <paragraph>, <text>, or <helloworldanythingiwant>.
It's whatever makes sense to you and your application.

Details about APIs

A - HTML TAGS
All of the following tags in this API have the namespace html like: <html:title>
<html:html>
This begins a HTML document. Equivelent to the current <html> tag.
Example:
<!DOCTYPE html>
<html:html>
  <!-- rest of HTML would go here -->
</html:html>
<html:head>
This begins an HTML's head. Equivelent to the current <html> tag. The tag contains data that isn't actually displayed (aside from the <html:title> which is displayed in the browser's windows). Rather, it's purpose is to get data and scripts that affect the display of the content in the <html:body>. These scripts and other sources include things like JavaScript, CSS, RSS feeds, etc.
Example:
<!DOCTYPE html>
<html:html>
  <html:head>
    <!-- Head content here, like the <html:title> tag -->
  </html:head>
</html:html>
<html:title>
This is the title of the HTML document. Equivalent to the current <title> tag. Browsers will use this for the tab bar, favorites, etc. and search engines will use this as the title of their links
Example:
<!DOCTYPE html>
<html:html>
  <html:head>
    <html:title>HTML6 Spec Version 0.1</html:title>
  </html:head>
</html:html>
<html:meta>
This is a bit different then the current HTML version. Meta data in HTML6 can be anything. Unlike HTML now, there are no required or non-standard meta types. It's used to store content for you as a developer, or for other sites as a way to grab information such as a page description.
Example:
<!DOCTYPE html>
<html:html>
  <html:head>
    <html:title>HTML6 Spec Version 0.1</html:title>
    <html:meta type="description" value="This is an example of HTML with namespaces">
  </html:head>
</html:html>
<html:link>
This links external documents and scripts such as CSS, JavaScript, RSS, favicons, etc. to the current document. Equivalent to the current <link> tag. This tag takes the following attributes:
  • charset: The character encoding such as "UTF-8".
  • href: The link to the source file.
  • media: The type of device the item should run on, for example, "mobile" or "tablet".
  • type: The MIME type of the document, for example, text/javascript.
Example:
<!DOCTYPE html>
<html:html>
  <html:head>
    <html:title>HTML6 Spec Version 0.1</html:title>
    <html:link src="js/main.js" title="Main Script" type="text/javascript">
  </html:head>
</html:html>
<html:body>
This is the body of the HTML document. Equivalent to the current <body> tag. This is where you'd place most of the stuff that would be visible to the users like text, media, and so on.
Example:
<!DOCTYPE html>
<html:html>
  <html:head>
    <html:title>HTML6 Spec Version 0.1</html:title>
  </html:head>
  <html:body>
    <!-- Your web page's content would go here -->
  </html:body>
</html:html>
<html:a>
This tag represents either an anchor on the page, or a link to another web page. Equivalent to the current <a>tag. The <html:a> tag takes one required attribute which is the href which directs the anchor or link where to go. For an anchor you'd use the syntax #id-of-element-to-link-to and for a link to another web page you'd simply insert the link like http://google.com.
Attributes available to the <a> tag are:
  • href
  • name
  • target (can be blank, parent, top or self)
Example:
<!DOCTYPE html>
<html:html>
  <html:head>
    <html:title>HTML6 Spec Version 0.1</html:title>
  </html:head>
  <html:body>
    <html:a href="http://google.com">Go to google.com!</html:a>
  </html:body>
</html:html>
<html:button>
Similar to <button> or <input type="button"> in HTML<=5, the <html:button> tag allows you to create a button for user interaction on a page.
Attributes available to the <html:button> tag are:
  • disabled
<!DOCTYPE html>
<html:html>
  <html:head>
    <html:title>HTML6 Spec Version 0.1</html:title>
  </html:head>
  <html:body>
    <html:button>Push me!</html:button>
  </html:body>
</html:html>
<html:media>
This tag encapsulates what we now have for media which are tags like <img>, <video>, <audio>, <embed>, and so on. Instead of a tag for each file type, the browser will just know how to run it by the type attribute, or will make a guess based on the file extension, or lastly, by the MIME type.
Example:
<!DOCTYPE html>
<html:html>
  <html:head>
    <html:title>HTML6 Spec Version 0.1</html:title>
  </html:head>
  <html:body>
    <!-- Image -->
    <html:media src="images/logo.jpg" type="image">
    <!-- Video, shows you don't "need" a type -->
    <html:media src="videos/cute-cat.mov">
    <!-- Some made up format, browser will ignore if it doesn't know it -->
    <html:media src="misc/example.abc" type="abc">
  </html:body>
</html:html>

B - HTML Forms
HTML Forms are separate from the HTML API to allow development on forms to not have to slow down for the entire HTML spec. Forms are constantly evolving with Sliders, color pickers, date and time pickers, progress bars and more. Forms really are sort of their own "thing" in HTML, so in HTML6 we've broken them into their own API.
<form:form>
This tag creates a new form. Has two attributes, method and action. As with current HTML forms, method can be POST or GET (they can be lowercase too) and will send the form with that as the HTTP header. More details on GET and POST can be found at W3.org. The action attribute tells the form where to send the data. By default the "method" is set to GET and the "action" is the current page.
Example:
<!DOCTYPE html>
<html:html>
  <html:head>
    <html:title>HTML6 Spec Version 0.1</html:title>
  </html:head>
  <html:body>
    <form:form method="post" action="/sendmail">
      <!-- Form inputs and stuff go here -->
    </form:form>
  </html:body>
</html:html>
<form:input>
This tag creates a new form input. Any type of form input that you can enter text into would be an input. In HTML currently this includes everything from a plain old text input to a <textarea> and would also include HTML5 style for inputs like email and url. The full list of possible input types are:
  • text
  • email
  • url
  • tel
  • search
  • number
  • datetime
  • date
  • month
  • week
  • time
  • datetime-local
  • textarea
  • password
  • file - (multiple)
The possible attributes on an input are:
  • name
  • disabled
  • readonly
  • placeholder
  • autofocus
  • required
  • novalidate
The following are attributes that will work on any input except file inputs:
  • maxlength
  • autocomplete
  • pattern
  • spellcheck
  • match - This is new to HTML6, give it a name of a field you want it to require a match on.
Example:
<!DOCTYPE html>
<html:html>
  <html:head>
    <html:title>HTML6 Spec Version 0.1</html:title>
  </html:head>
  <html:body>
    <form:form method="post" action="/sendmail">
      <!-- Simple input (defaults to text) -->
      <form:input>
      <!--  A new HTML6 match example -->
      <form:input type="password" name="user_password">
      <form:input type="password" match="user_password">
      <!-- Advanced example -->
      <form:input type="email" placeholder="user@site.com" autofocus required>
    </form:form>
  </html:body>
</html:html>
<form:select>
The <form:select> tag lets a user select from options rather than input anything. For example an HTML<=5<select> would be close to the same. Some others would be a calendar, color picker, and range because these are predefined values in which you choose from.
The possible input types follow along with attributes that are specific to it:
  • select - (multiple)
  • color
  • calendar - (range)
  • meter - (range, step)
Attributes that work for all select types are:
  • name
  • readonly
  • disabled
  • required
  • autofocus
Example:
<!DOCTYPE html>
<html:html>
  <html:head>
    <html:title>HTML6 Spec Version 0.1</html:title>
  </html:head>
  <html:body>
    <form:form method="post" action="/scheduler">
      <!-- Normal select -->
      <html:select type="select" name="favorite_color">
      <!-- Calendar example -->
      <html:select type="calendar" name="the_calendar" range="10/10/10-10/10/11">
    </form:form>
  </html:body>
</html:html>
<form:status>
The <form:status> tag allows you to give feedback, or a "status" update to your users. Useful for an upload progress bar or steps in a multi-page form, for example. These are similar to the <progress> and <meter>elements in HTML5.
  • progress
  • meter
Attributes that work for all status types are:
  • min
  • max
  • value
Example:
<!DOCTYPE html>
<html:html>
  <html:head>
    <html:title>HTML6 Spec Version 0.1</html:title>
  </html:head>
  <html:body>
    <form:form method="post" action="/upload">
      <!-- Example showing "steps" in a form -->
      <form:status type="meter" min="1" max="3" value="2">
      <message>You're currently on step 2 of 3</message>
      <!-- Example showing an upload progress bar -->
      <form:status type="progress" max="100" value="25">
    </form:form>
  </html:body>
</html:html>
<form:label>
The <form:label> tag allows you to label inputs for the user. It links text to an input and when click will focus on the connected input. It matches the label's for attribute to the id of any form element.
Attributes that work for the <form:label> tag are:
  • for
Example:
<!DOCTYPE html>
<html:html>
  <html:head>
    <html:title>HTML6 Spec Version 0.1</html:title>
  </html:head>
  <html:body>
    <form:form method="post" action="/login">
      <form:label for="username">Username</form:label>
      <form:input id="username" name="username">
      <form:label for="password">Password</form:label>
      <form:input id="password" name="password" type="password">
    </form:form>
  </html:body>
</html:html>
<form:submit>
Just like <input type="submit"> in HTML<=5, <form:submit> will create a button which submits your form. If a submit button is present in a form, pressing enter while focused inside of a form will submit it.
Attributes that work for the <form:submit> tag are:
  • name
  • value
Example:
<!DOCTYPE html>
<html:html>
  <html:head>
    <html:title>HTML6 Spec Version 0.1</html:title>
  </html:head>
  <html:body>
    <form:form method="post" action="/login">
      <form:label>Login</form:label>
      <form:input name="username">
      <form:input name="password" type="password">
      <form:submit name="submit" value="submit">
    </form:form>
  </html:body>
</html:html>

Tag types
In HTML6, like in all previous HTML versions, there are two types of tags: single tags and double tags. Single tags can't have any text content, they only have attributes. This is an example of single tag (both elements are interpreted the same way):
<html:meta type="author" content="m93a">
<html:meta type="author" content="m93a" />
Unlike the double tag, the single tag doesn't need to be closed. Double tags usually have some text content so they are made of an opening and closing tag. If it has no text content, it can be shortened to the self-closing single variant. Examples:
<html:link href="./a.html">Text content</html:link>

<!-- This shortand... -->
<foo class="bar" />
<!-- ...means in fact this: -->
<foo class="bar"></foo>


Tuesday, 12 May 2015

Hadoop


What it is and why it matters
Hadoop is an open-source software framework for storing and processing big data in a distributed fashion on large clusters of commodity hardware. Essentially, it accomplishes two tasks: massive data storage and faster processing.
Following Points
·         Open-source software. Open source software differs from commercial software due to the broad and open network of developers that create and manage the programs. Traditionally, it's free to download, use and contribute to, though more and more commercial versions of Hadoop are becoming available.
·         Framework. In this case, it means everything you need to develop and run your software applications is provided – programs, tool sets, connections, etc.
·         Distributed. Data is divided and stored across multiple computers, and computations can be run in parallel across multiple connected machines.
·         Massive storage. The Hadoop framework can store huge amounts of data by breaking the data into blocks and storing it on clusters of lower-cost commodity hardware.
·         Faster processing. How?  Hadoop processes large amounts of data in parallel across clusters of tightly connected low-cost computers for quick results.
How did Hadoop get here?
As the World Wide Web grew at a dizzying pace in the late 1900s and early 2000s, search engines and indexes were created to help people find relevant information amid all of that text-based content. During the early years, search results were returned by humans. It’s true! But as the number of web pages grew from dozens to millions, automation was required. Web crawlers were created, many as university-led research projects, and search engine startups took off (Yahoo, AltaVista, etc.).
One such project was Nutch – an open-source web search engine – and the brainchild of Doug Cutting and Mike Cafarella. Their goal was to invent a way to return web search results faster by distributing data and calculations across different computers so multiple tasks could be accomplished simultaneously. Also during this time, another search engine project called Google was in progress. It was based on the same concept – storing and processing data in a distributed, automated way so that more relevant web search results could be returned faster.
In 2006, Cutting joined Yahoo and took with him the Nutch project as well as ideas based on Google’s early work with automating distributed data storage and processing. The Nutch project was divided. The web crawler portion remained as Nutch. The distributed computing and processing portion became Hadoop (named after Cutting’s son’s toy elephant). In 2008, Yahoo released Hadoop as an open-source project, and, today Hadoop’s framework and family of technologies are managed and maintained by the non-profit Apache Software Foundation (ASF), a global community of software developers and contributors.
Why is Hadoop important?
Since its inception, Hadoop has become one of the most talked about technologies. Why? One of the top reasons (and why it was invented) is its ability to handle huge amounts of data – any kind of data – quickly. With volumes and varieties of data growing each day, especially from social media and automated sensors, that’s a key consideration for most organizations. Other reasons include:
·         Low cost. The open-source framework is free and uses commodity hardware to store large quantities of data.
·         Computing power. Its distributed computing model can quickly process very large volumes of data. The more computing nodes you use the more processing power you have.
·         Scalability. You can easily grow your system simply by adding more nodes. Little administration is required.
·         Storage flexibility. Unlike traditional relational databases, you don’t have to preprocess data before storing it. And that includes unstructured data like text, images and videos. You can store as much data as you want and decide how to use it later.
·         Inherent data protection and self-healing capabilities. Data and application processing are protected against hardware failure. If a node goes down, jobs are automatically redirected to other nodes to make sure the distributed computing does not fail. And it automatically stores multiple copies of all data.

What’s in Hadoop?
Hadoop components have funny names, which is sort of understandable knowing that “Hadoop” was the name of a yellow toy elephant owned by the son of one of its inventors.
Currently three core components are included with your basic download from the Apache Software Foundation.
·         HDFS – the Java-based distributed file system that can store all kinds of data without prior organization.
·         MapReduce – a software programming model for processing large sets of data in parallel.
·         YARN – a resource management framework for scheduling and handling resource requests from distributed applications.
Other components that have achieved top-level Apache project status and are available include:
·         Pig – a platform for manipulating data stored in HDFS. It consists of a compiler for MapReduce programs and a high-level language called Pig Latin. It provides a way to perform data extractions, transformations and loading, and basic analysis without having to write MapReduce programs.
·         Hive – a data warehousing and SQL-like query language that presents data in the form of tables. Hive programming is similar to database programming. (It was initially developed by Facebook.)
·         HBase – a nonrelational, distributed database that runs on top of Hadoop. HBase tables can serve as input and output for MapReduce jobs.
·         Zookeeper – an application that coordinates distributed processes.
·         Ambari – a web interface for managing, configuring and testing Hadoop services and components.
·         Flume – software that collects, aggregates and moves large amounts of streaming data into HDFS.
·         Sqoop – a connection and transfer mechanism that moves data between Hadoop and relational databases.
·         Oozie – a Hadoop job scheduler.

How does data get into Hadoop?
There are numerous ways to get data into Hadoop. Here are just a few:
·         You can load files to the file system using simple Java commands, and HDFS takes care of making multiple copies of data blocks and distributing those blocks over multiple nodes in Hadoop.
·         If you have a large number of files, a shell script that will run multiple “put” commands in parallel will speed up the process. You don’t have to write MapReduce code.
·         Create a cron job to scan a directory for new files and “put” them in HDFS as they show up. This is useful for things like downloading email at regular intervals.
·         Mount HDFS as a file system and simply copy or write files there.
·         Use Sqoop to import structured data from a relational database to HDFS, Hive and HBase. It can also extract data from Hadoop and export it to relational databases and data warehouses.
·         Use Flume to continuously load data from logs into Hadoop.
·         Use third-party vendor connectors (like SAS/ACCESS®).
Then what happens?
Going beyond its original goal of searching millions (or billions) of web pages and returning relevant results, many organizations are looking to Hadoop as their next big data platform. Here are some of the more popular uses for the framework today.
1.   Low-cost storage and active data archive. The modest cost of commodity hardware makes Hadoop useful for storing and combining big data such as transactional, social media, sensor, machine, scientific, click streams, etc. The low-cost storage lets you keep information that is not currently critical but could become useful later for business analytics.
2.   Staging area for a data warehouse and analytics store. One of the most prevalent uses is to stage large amounts of raw data for loading into an enterprise data warehouse (EDW) or an analytical store for activities such as advanced analytics, query and reporting, etc. Organizations are looking at Hadoop to handle new types of data (e.g., unstructured), as well as to offload some historical data from their EDWs.
3.   Data lake. Hadoop is often used to store large amounts of data without the constraints introduced by schemas commonly found in the SQL-based world. It is used as a low-cost compute-cycle platform that supports processing ETL and data quality jobs in parallel using hand-coded or commercial data management technologies. Refined results can then be passed to other systems (e.g., EDWs, analytic marts) as needed.
4.   Sandbox for discovery and analysis. Because Hadoop was designed to deal with volumes of data in a variety of shapes and forms, it can enable analytics. Big data analytics on Hadoop can help run your organization more efficiently uncover new opportunities and derive next-level competitive advantage. The sandbox setup provides a quick and perfect opportunity to innovate with minimal investment.

What challenges may be encountered?
First of all, MapReduce is not a good match for all problems. It’s good for simple requests for information and problems that can be broken up into independent units. But it is inefficient for iterative and interactive analytic tasks. MapReduce is file-intensive. Because the nodes don’t intercommunicate except through sorts and shuffles, iterative algorithms require multiple map-shuffle/sort-reduce phases to complete. This creates multiple files between MapReduce phases and is very inefficient for advanced analytic computing.
Second, there’s a talent gap. Because it is a relatively new technology, it is difficult to find entry-level programmers who have sufficient Java skills to be productive with MapReduce. This talent gap is one reason distribution providers are racing to put relational (SQL) technology on top of Hadoop. It is much easier to find programmers with SQL skills than MapReduce skills. And, Hadoop administration seems part art and part science, requiring low-level knowledge of operating systems, hardware and Hadoop kernel settings.
Another challenge centers around the fragmented data security issues in Hadoop, though new tools and technologies are surfacing. The Kerberos authentication protocol is a great step forward for making Hadoop environments secure. And, Hadoop does not have easy-to-use, full-feature tools for data management, data cleansing, governance and metadata. Especially lacking are tools for data quality and standardization.