You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@edgent.apache.org by wc...@apache.org on 2016/03/22 23:04:46 UTC

[1/2] incubator-quarks-website git commit: from 21a160785b4950ade051f92fc39b93722c674603 [Forced Update!]

Repository: incubator-quarks-website
Updated Branches:
  refs/heads/asf-site 3280fc074 -> 6d865d4bd (forced update)


http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/recipes/recipe_source_function.html
----------------------------------------------------------------------
diff --git a/content/recipes/recipe_source_function.html b/content/recipes/recipe_source_function.html
new file mode 100644
index 0000000..0946b62
--- /dev/null
+++ b/content/recipes/recipe_source_function.html
@@ -0,0 +1,604 @@
+<!DOCTYPE html>
+  <head>
+
+ <meta charset="utf-8">
+<meta http-equiv="X-UA-Compatible" content="IE=edge">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<meta name="description" content="">
+<meta name="keywords" content=" ">
+<title>Recipe 2. Writing a Source Function  | Quarks Documentation</title>
+<link rel="stylesheet" type="text/css" href="../css/syntax.css">
+<link rel="stylesheet" type="text/css" href="../css/font-awesome.min.css">
+<!--<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">-->
+<link rel="stylesheet" type="text/css" href="../css/modern-business.css">
+<link rel="stylesheet" type="text/css" href="../css/lavish-bootstrap.css">
+<link rel="stylesheet" type="text/css" href="../css/customstyles.css">
+<link rel="stylesheet" type="text/css" href="../css/theme-blue.css">
+<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
+<script src="../js/jquery.navgoco.min.js"></script>
+<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/2.0.0/anchor.min.js"></script>
+<script src="../js/toc.js"></script>
+<script src="../js/customscripts.js"></script>
+<link rel="shortcut icon" href="../common_images/favicon.ico" type="image/x-icon">
+<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
+<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
+<!--[if lt IE 9]>
+<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
+<![endif]-->
+
+
+
+
+
+
+
+ 
+
+<script>
+  $(function () {
+      $('[data-toggle="tooltip"]').tooltip()
+  })
+</script>
+
+
+
+  </head>
+
+<body>
+
+   <!-- Navigation -->
+<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
+    <div class="container topnavlinks">
+        <div class="navbar-header">
+            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
+                <span class="sr-only">Toggle navigation</span>
+                <span class="icon-bar"></span>
+                <span class="icon-bar"></span>
+                <span class="icon-bar"></span>
+            </button>
+
+            <a class="fa fa-home fa-lg navbar-brand" href="home.html">&nbsp;<span class="projectTitle"> Quarks Documentation</span></a>
+
+        </div>
+        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
+            <ul class="nav navbar-nav navbar-right">
+                <!-- entries without drop-downs appear here -->
+                <!-- conditional logic to control which topnav appears for the audience defined in the configuration file.-->
+                
+
+
+
+
+
+
+
+
+                <li class="dropdown">
+                    
+                    
+                    
+                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Github Repos<b class="caret"></b></a>
+                    <ul class="dropdown-menu">
+                        
+                        
+                        
+                        <li><a href="https://github.com/apache/incubator-quarks" target="_blank">Source code</a></li>
+                        
+                        
+                        
+                        
+                        
+                        <li><a href="https://github.com/apache/incubator-quarks-website" target="_blank">Website/Documentation</a></li>
+                        
+                        
+                        
+                        
+
+                    </ul>
+                </li>
+                
+                
+
+
+                
+                
+                
+                
+                <li><a href="https://quarks-edge.github.io/quarks/docs/javadoc/index.html" target="_blank">Javadoc</a></li>
+                
+                
+                
+                
+
+
+                <!-- entries with drop-downs appear here -->
+                <!-- conditional logic to control which topnav appears for the audience defined in the configuration file.-->
+
+                <li class="dropdown">
+                    
+                    
+                    
+                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Quarks Resources<b class="caret"></b></a>
+                    <ul class="dropdown-menu">
+                        
+                        
+                        
+                        <li><a href="https://github.com/apache/incubator-quarks/releases" target="_blank">Download</a></li>
+                        
+                        
+                        
+                        
+                        
+                        <li><a href="samples">Samples</a></li>
+                        
+                        
+                        
+                        
+                        
+                        <li><a href="faq">FAQ</a></li>
+                        
+                        
+                        
+                        
+
+                    </ul>
+                </li>
+                
+                
+
+
+                <!-- special insertion -->
+
+               
+                <!-- Send feedback function -->
+<script>
+function SendLinkByMail(href) {
+var subject= "Quarks Documentation feedback";
+var body = "I have some feedback about the Recipe 2. Writing a Source Function page: ";
+body += window.location.href;
+body += "";
+var uri = "mailto:?subject=";
+uri += encodeURIComponent(subject);
+uri += "&body=";
+uri += encodeURIComponent(body);
+window.location.href = uri;
+}
+</script>
+
+<li><a href="mailto:dev@quarks.incubator.apache.org" target="_blank"><i class="fa fa-envelope-o"></i> Feedback</a></li>
+
+
+                <!--uncomment this block if you want simple search instead of algolia-->
+                <li>
+                     <!--start search-->
+                    <div id="search-demo-container">
+                        <input type="text" id="search-input" placeholder="search...">
+                        <ul id="results-container"></ul>
+                    </div>
+                    <script src="../js/jekyll-search.js" type="text/javascript"></script>
+                    <script type="text/javascript">
+                        SimpleJekyllSearch.init({
+                            searchInput: document.getElementById('search-input'),
+                            resultsContainer: document.getElementById('results-container'),
+                            dataSource: '../search.json',
+                            searchResultTemplate: '<li><a href="{url}" title="Recipe 2. Writing a Source Function">{title}</a></li>',
+                        noResultsText: 'No results found.',
+                                limit: 10,
+                                fuzzy: true,
+                        })
+                    </script>
+                     <!--end search-->
+                </li>
+
+            
+        </div>
+        <!-- /.container -->
+</nav>
+
+
+    <!-- Page Content -->
+    <div class="container">
+        <div class="col-lg-12">&nbsp;</div>
+
+
+<!-- Content Row -->
+<div class="row">
+    <!-- Sidebar Column -->
+    <div class="col-md-3">
+
+        <script>
+
+            $(document).ready(function() {
+                // Initialize navgoco with default options
+                $("#mysidebar").navgoco({
+                    caretHtml: '',
+                    accordion: true,
+                    openClass: 'active', // open
+                    save: false, // leave false or nav highlighting doesn't work right
+                    cookie: {
+                        name: 'navgoco',
+                        expires: false,
+                        path: '/'
+                    },
+                    slide: {
+                        duration: 400,
+                        easing: 'swing'
+                    }
+                });
+
+                $("#collapseAll").click(function(e) {
+                    e.preventDefault();
+                    $("#mysidebar").navgoco('toggle', false);
+                });
+
+                $("#expandAll").click(function(e) {
+                    e.preventDefault();
+                    $("#mysidebar").navgoco('toggle', true);
+                });
+
+            });
+
+        </script>
+
+
+        
+
+
+
+
+
+
+
+
+
+        <ul id="mysidebar" class="nav">
+
+            <span class="siteTagline">Quarks</span>
+            <span class="versionTagline">Version 0.3.0</span>
+
+            
+            
+            
+                
+            
+            <li><a href="#">Overview</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../docs/quarks_index.html">Introduction</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../docs/faq.html">FAQ</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
+            <li><a href="#">Get Started</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../docs/quarks-getting-started.html">1. Getting Started Guide</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../docs/common-quarks-operations.html">2. Common Operations</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
+            <li><a href="#">Sample Programs</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../docs/samples.html">1. Samples</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../docs/quickstart.html">2. Quickstart IBM Watson IoT Platform</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
+            <li><a href="#">Using The Console</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../docs/console.html">1. Using The Console</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
+            <li><a href="#">Get involved</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../docs/getinvolved.html">How to participate</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../docs/committers.html">Committers</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+                
+
+
+                <!-- if you aren't using the accordion, uncomment this block:
+
+                     <p class="external">
+                         <a href="#" id="collapseAll">Collapse All</a> | <a href="#" id="expandAll">Expand All</a>
+                     </p>
+                 -->
+				 <br/>
+			</li>
+		</ul>
+		<div class="row">
+		<div class="col-md-12">
+			
+<!-- this handles the automatic toc. use ## for subheads to auto-generate the on-page minitoc. if you use html tags, you must supply an ID for the heading element in order for it to appear in the minitoc. -->
+<script>
+$( document ).ready(function() {
+  // Handler for .ready() called.
+
+$('#toc').toc({ minimumHeaders: 0, listType: 'ul', showSpeed: 0, headers: 'h2,h3,h4' });
+
+/* this offset helps account for the space taken up by the floating toolbar. */
+$('#toc').on('click', 'a', function() {
+  var target = $(this.getAttribute('href'))
+    , scroll_target = target.offset().top
+
+  $(window).scrollTop(scroll_target - 10);
+  return false
+})
+  
+});
+</script>
+
+
+<div id="toc"></div>
+
+		</div>
+	</div>
+	</div>
+	
+    <!-- this highlights the active parent class in the navgoco sidebar. this is critical so that the parent expands when you're viewing a page. This must appear below the sidebar code above. Otherwise, if placed inside customscripts.js, the script runs before the sidebar code runs and the class never gets inserted.-->
+    <script>$("li.active").parents('li').toggleClass("active");</script>
+
+
+            <!-- Content Column -->
+            <div class="col-md-9">
+                
+                <div class="post-header">
+   <h1 class="post-title-main">Recipe 2. Writing a Source Function</h1>
+</div>
+
+<div class="post-content">
+
+   
+
+<!-- this handles the automatic toc. use ## for subheads to auto-generate the on-page minitoc. if you use html tags, you must supply an ID for the heading element in order for it to appear in the minitoc. -->
+<script>
+$( document ).ready(function() {
+  // Handler for .ready() called.
+
+$('#toc').toc({ minimumHeaders: 0, listType: 'ul', showSpeed: 0, headers: 'h2,h3,h4' });
+
+/* this offset helps account for the space taken up by the floating toolbar. */
+$('#toc').on('click', 'a', function() {
+  var target = $(this.getAttribute('href'))
+    , scroll_target = target.offset().top
+
+  $(window).scrollTop(scroll_target - 10);
+  return false
+})
+  
+});
+</script>
+
+
+<div id="toc"></div>
+
+
+    
+
+    <a target="_blank" href="https://github.com/apache/incubator-quarks-website/blob/master/site/recipes/recipe_source_function.md" class="btn btn-default githubEditButton" role="button"><i class="fa fa-github fa-lg"></i> Edit me</a>
+    
+  <p>In the previous <a href="recipe_hello_quarks">Hello Quarks!</a> example, we create a data source which only generates a single Java String and prints it to output. Yet Quarks sources support the ability generate any data type as a source, not just Java types such as Strings and Doubles. Moreover, because the user supplies the code which generates the data, the user has complete flexibility for <em>how</em> the data is generated. This recipe demonstrates how a user could write such a custom data source.</p>
+
+<h2 id="custom-source-reading-the-lines-of-a-web-page">Custom Source: Reading the Lines of a Web Page</h2>
+
+<div class="alert alert-info" role="alert"><i class="fa fa-info-circle"></i> <b>Note: </b> Quarks' API provides convenience methods for performing HTTP requests. For the sake of example we are writing a HTTP data source manually, but in principle there are easier methods. </div>
+
+<p>One example of a custom data source could be retrieving the contents of a web page and printing each line to output. For example, the user could be querying the Yahoo Finance website for the most recent stock price data of Bank of America, Cabot Oil &amp; Gas, and Freeport-McMoRan Inc:</p>
+<div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="p">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">Exception</span> <span class="o">{</span>
+        <span class="n">DirectProvider</span> <span class="n">dp</span> <span class="o">=</span> <span class="k">new</span> <span class="n">DirectProvider</span><span class="o">();</span>
+        <span class="n">Topology</span> <span class="n">top</span> <span class="o">=</span> <span class="n">dp</span><span class="o">.</span><span class="na">newTopology</span><span class="o">();</span>
+
+        <span class="kd">final</span> <span class="n">URL</span> <span class="n">url</span> <span class="o">=</span> <span class="k">new</span> <span class="n">URL</span><span class="o">(</span><span class="s">"http://finance.yahoo.com/d/quotes.csv?s=BAC+COG+FCX&amp;f=snabl"</span><span class="o">);</span>
+    <span class="o">}</span>
+</code></pre></div>
+<p>Given the correctly formatted URL to request the data, we can use the <em>Topology.source</em> method to generate each line of the page as a data item on the stream. <code>Topology.source</code> takes a Java Supplier that returns an Iterable. The supplier is invoked once, and the items returned from the Iterable are used as the stream&#39;s data items. For example, the following <code>queryWebsite</code> method returns a supplier which queries  a URL and returns an Iterable of its contents:</p>
+<div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="kd">private</span> <span class="kd">static</span> <span class="n">Supplier</span><span class="o">&lt;</span><span class="n">Iterable</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span> <span class="o">&gt;</span> <span class="n">queryWebsite</span><span class="o">(</span><span class="n">URL</span> <span class="n">url</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">Exception</span><span class="o">{</span>
+        <span class="k">return</span> <span class="o">()</span> <span class="o">-&gt;</span> <span class="o">{</span>
+            <span class="n">List</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span> <span class="n">lines</span> <span class="o">=</span> <span class="k">new</span> <span class="n">LinkedList</span><span class="o">&lt;&gt;();</span>
+            <span class="k">try</span> <span class="o">{</span>
+                <span class="n">InputStream</span> <span class="n">is</span> <span class="o">=</span> <span class="n">url</span><span class="o">.</span><span class="na">openStream</span><span class="o">();</span>
+                <span class="n">BufferedReader</span> <span class="n">br</span> <span class="o">=</span> <span class="k">new</span> <span class="n">BufferedReader</span><span class="o">(</span>
+                        <span class="k">new</span> <span class="n">InputStreamReader</span><span class="o">(</span><span class="n">is</span><span class="o">));</span>
+
+                <span class="k">for</span><span class="o">(</span><span class="n">String</span> <span class="n">s</span> <span class="o">=</span> <span class="n">br</span><span class="o">.</span><span class="na">readLine</span><span class="o">();</span> <span class="n">s</span> <span class="o">!=</span> <span class="kc">null</span><span class="o">;</span> <span class="n">s</span> <span class="o">=</span> <span class="n">br</span><span class="o">.</span><span class="na">readLine</span><span class="o">())</span>
+                    <span class="n">lines</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">s</span><span class="o">);</span>
+
+            <span class="o">}</span> <span class="k">catch</span> <span class="o">(</span><span class="n">Exception</span> <span class="n">e</span><span class="o">)</span> <span class="o">{</span>
+                <span class="n">e</span><span class="o">.</span><span class="na">printStackTrace</span><span class="o">();</span>
+            <span class="o">}</span>
+            <span class="k">return</span> <span class="n">lines</span><span class="o">;</span>
+        <span class="o">};</span>
+    <span class="o">}</span>
+</code></pre></div>
+<p>When invoking <code>Topology.source</code>, we can use <code>queryWebsite</code> to return the required supplier, passing in the URL.</p>
+<div class="highlight"><pre><code class="language-java" data-lang="java">     <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="p">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">Exception</span> <span class="o">{</span>
+        <span class="n">DirectProvider</span> <span class="n">dp</span> <span class="o">=</span> <span class="k">new</span> <span class="n">DirectProvider</span><span class="o">();</span>
+        <span class="n">Topology</span> <span class="n">top</span> <span class="o">=</span> <span class="n">dp</span><span class="o">.</span><span class="na">newTopology</span><span class="o">();</span>
+
+        <span class="kd">final</span> <span class="n">URL</span> <span class="n">url</span> <span class="o">=</span> <span class="k">new</span> <span class="n">URL</span><span class="o">(</span><span class="s">"http://finance.yahoo.com/d/quotes.csv?s=BAC+COG+FCX&amp;f=snabl"</span><span class="o">);</span>
+
+        <span class="n">TStream</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span> <span class="n">linesOfWebsite</span> <span class="o">=</span> <span class="n">top</span><span class="o">.</span><span class="na">source</span><span class="o">(</span><span class="n">queryWebsite</span><span class="o">(</span><span class="n">url</span><span class="o">));</span>
+    <span class="o">}</span>
+</code></pre></div>
+<p>Source methods such as <code>Topology.source</code> and <code>Topology.strings</code> return a <code>TStream</code>. If we print the <code>linesOfWebsite</code> stream to standard output and run the application, we can see that it correctly generates the data and feeds it into the Quarks runtime:</p>
+
+<p>Output:</p>
+<div class="highlight"><pre><code class="language-java" data-lang="java"><span class="s">"BAC"</span><span class="o">,</span><span class="s">"Bank of America Corporation Com"</span><span class="o">,</span><span class="mf">13.150</span><span class="o">,</span><span class="mf">13.140</span><span class="o">,</span><span class="s">"12:00pm - &lt;b&gt;13.145&lt;/b&gt;"</span>
+<span class="s">"COG"</span><span class="o">,</span><span class="s">"Cabot Oil &amp; Gas Corporation Com"</span><span class="o">,</span><span class="mf">21.6800</span><span class="o">,</span><span class="mf">21.6700</span><span class="o">,</span><span class="s">"12:00pm - &lt;b&gt;21.6775&lt;/b&gt;"</span>
+<span class="s">"FCX"</span><span class="o">,</span><span class="s">"Freeport-McMoRan, Inc. Common S"</span><span class="o">,</span><span class="mf">8.8200</span><span class="o">,</span><span class="mf">8.8100</span><span class="o">,</span><span class="s">"12:00pm - &lt;b&gt;8.8035&lt;/b&gt;"</span>
+</code></pre></div>
+<h2 id="polling-source-reading-data-periodically">Polling source: reading data periodically</h2>
+
+<p>A much more common scenario for a developer is the periodic generation of data from a source operator -- a data source may need to be polled every 5 seconds, 3 hours, or any time frame. To this end, <code>Topology</code> exposes the <code>poll</code> method which can be used to call a function at the frequency of the user&#39;s choosing. For example, a user might want to query Yahoo Finance every two seconds to retrieve the most up to date ticker price for a stock:</p>
+<div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="p">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">Exception</span> <span class="o">{</span>
+        <span class="n">DirectProvider</span> <span class="n">dp</span> <span class="o">=</span> <span class="k">new</span> <span class="n">DirectProvider</span><span class="o">();</span>
+        <span class="n">Topology</span> <span class="n">top</span> <span class="o">=</span> <span class="n">dp</span><span class="o">.</span><span class="na">newTopology</span><span class="o">();</span>
+
+        <span class="kd">final</span> <span class="n">URL</span> <span class="n">url</span> <span class="o">=</span> <span class="k">new</span> <span class="n">URL</span><span class="o">(</span><span class="s">"http://finance.yahoo.com/d/quotes.csv?s=BAC+COG+FCX&amp;f=snabl"</span><span class="o">);</span>
+
+        <span class="n">TStream</span><span class="o">&lt;</span><span class="n">Iterable</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;&gt;</span> <span class="n">source</span> <span class="o">=</span> <span class="n">top</span><span class="o">.</span><span class="na">poll</span><span class="o">(</span><span class="n">queryWebsite</span><span class="o">(</span><span class="n">url</span><span class="o">),</span> <span class="mi">2</span><span class="o">,</span> <span class="n">TimeUnit</span><span class="o">.</span><span class="na">SECONDS</span><span class="o">);</span>
+        <span class="n">source</span><span class="o">.</span><span class="na">print</span><span class="o">();</span>
+
+        <span class="n">dp</span><span class="o">.</span><span class="na">submit</span><span class="o">(</span><span class="n">top</span><span class="o">);</span>
+    <span class="o">}</span>
+</code></pre></div>
+<p><strong>Output:</strong>
+<br>
+<img src="images/pollingSource.gif"></p>
+
+<p>It&#39;s important to note that calls to <code>DirectProvider.submit</code> are non-blocking; the main thread will exit, and the threads executing the topology will continue to run. (Also, to see changing stock prices, the above example needs to be run during open trading hours. Otherwise, it will simply return the same results every time the website is polled).</p>
+
+
+<div class="tags">
+    
+</div>
+
+<!-- 
+
+    <div id="disqus_thread"></div>
+    <script type="text/javascript">
+        /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
+        var disqus_shortname = 'idrbwjekyll'; // required: replace example with your forum shortname
+
+        /* * * DON'T EDIT BELOW THIS LINE * * */
+        (function() {
+            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+        })();
+    </script>
+    <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+ -->
+
+</div>
+
+
+
+<footer>
+            <div class="row">
+                <div class="col-lg-12 footer">
+               
+ Site last generated: Mar 22, 2016 <br />
+
+                </div>
+            </div>
+</footer>
+            </div><!-- /.row -->
+
+    </div>    <!-- /.container -->
+
+</body>
+
+
+</html>
+

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/search.json
----------------------------------------------------------------------
diff --git a/content/search.json b/content/search.json
index 4069749..55d4bc7 100644
--- a/content/search.json
+++ b/content/search.json
@@ -132,6 +132,28 @@
 
 
 {
+"title": "Recipe 1. Hello Quarks!",
+"tags": "",
+"keywords": "",
+"url": "../recipes/recipe_hello_quarks",
+"summary": ""
+},
+
+
+
+
+{
+"title": "Recipe 2. Writing a Source Function",
+"tags": "",
+"keywords": "",
+"url": "../recipes/recipe_source_function",
+"summary": ""
+},
+
+
+
+
+{
 "title": "Sample Programs",
 "tags": "",
 "keywords": "",

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/title-checker.html
----------------------------------------------------------------------
diff --git a/content/title-checker.html b/content/title-checker.html
index 6c124a9..f06b36e 100644
--- a/content/title-checker.html
+++ b/content/title-checker.html
@@ -914,5 +914,201 @@
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 </body>
 </html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/titlepage.html
----------------------------------------------------------------------
diff --git a/content/titlepage.html b/content/titlepage.html
index 0ae65b4..3bfe53f 100644
--- a/content/titlepage.html
+++ b/content/titlepage.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -465,7 +490,7 @@ $('#toc').on('click', 'a', function() {
       <div class="printTitleArea">
         <div class="printTitle"></div>
         <div class="printSubtitle"></div>
-        <div class="lastGeneratedDate">Last generated: March 21, 2016</div>
+        <div class="lastGeneratedDate">Last generated: March 22, 2016</div>
         <hr />
 
         <div class="printTitleImage">
@@ -511,7 +536,7 @@ $('#toc').on('click', 'a', function() {
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/tocpage.html
----------------------------------------------------------------------
diff --git a/content/tocpage.html b/content/tocpage.html
index 18efdca..5c674b8 100644
--- a/content/tocpage.html
+++ b/content/tocpage.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -521,6 +546,26 @@ $('#toc').on('click', 'a', function() {
     
     
         
+        <li class="sectionHead">Quarks Cookbook
+            <ul>
+                
+                
+                <li><a href="/recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a>
+                    
+        </li>
+        
+        
+                
+                <li><a href="/recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a>
+                    
+        </li>
+        
+        
+    </ul>
+    </li>
+    
+    
+        
         <li class="sectionHead">Sample Programs
             <ul>
                 
@@ -607,7 +652,7 @@ $('#toc').on('click', 'a', function() {
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/urls_mydoc.txt
----------------------------------------------------------------------
diff --git a/content/urls_mydoc.txt b/content/urls_mydoc.txt
index 5e312e7..4770b04 100644
--- a/content/urls_mydoc.txt
+++ b/content/urls_mydoc.txt
@@ -50,6 +50,22 @@
 
 
  
+/recipes/recipe_hello_quarks:
+  title: "Recipe 1. Hello Quarks!"
+  url: "../recipes/recipe_hello_quarks.html"
+  link: "<a href='../recipes/recipe_hello_quarks.html'>Recipe 1. Hello Quarks!</a>"
+
+
+ 
+/recipes/recipe_source_function:
+  title: "Recipe 2. Writing a Source Function"
+  url: "../recipes/recipe_source_function.html"
+  link: "<a href='../recipes/recipe_source_function.html'>Recipe 2. Writing a Source Function</a>"
+
+
+
+
+ 
 /docs/samples:
   title: "1. Samples"
   url: "../docs/samples.html"


[2/2] incubator-quarks-website git commit: from 21a160785b4950ade051f92fc39b93722c674603

Posted by wc...@apache.org.
from 21a160785b4950ade051f92fc39b93722c674603


Project: http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/commit/6d865d4b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/tree/6d865d4b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/diff/6d865d4b

Branch: refs/heads/asf-site
Commit: 6d865d4bd01a39ff20425cc2da33451ef59cb366
Parents: bcdfcf4
Author: wcmarsha <wc...@us.ibm.com>
Authored: Tue Mar 22 15:01:43 2016 -0700
Committer: wcmarsha <wc...@us.ibm.com>
Committed: Tue Mar 22 15:01:43 2016 -0700

----------------------------------------------------------------------
 content/404.html                            |  27 +-
 content/algolia_search.json                 |  26 +
 content/docs/committers.html                |  27 +-
 content/docs/common-quarks-operations.html  |  27 +-
 content/docs/community.html                 |  27 +-
 content/docs/console.html                   |  27 +-
 content/docs/faq.html                       |  27 +-
 content/docs/home.html                      |  27 +-
 content/docs/overview.html                  |  27 +-
 content/docs/quarks-getting-started.html    |  27 +-
 content/docs/quarks_index.html              |  27 +-
 content/docs/quickstart.html                |  27 +-
 content/docs/samples.html                   |  27 +-
 content/docs/search.html                    |  27 +-
 content/docs/tag_collaboration.html         |  31 +-
 content/docs/tag_content_types.html         |  31 +-
 content/docs/tag_formatting.html            |  31 +-
 content/docs/tag_getting_started.html       |  31 +-
 content/docs/tag_mobile.html                |  31 +-
 content/docs/tag_navigation.html            |  31 +-
 content/docs/tag_publishing.html            |  31 +-
 content/docs/tag_single_sourcing.html       |  31 +-
 content/docs/tag_special_layouts.html       |  31 +-
 content/prince-file-list.txt                |  14 +
 content/recipes/images/pollingSource.gif    | Bin 0 -> 61128 bytes
 content/recipes/recipe_hello_quarks.html    | 576 +++++++++++++++++++++
 content/recipes/recipe_source_function.html | 604 +++++++++++++++++++++++
 content/search.json                         |  22 +
 content/title-checker.html                  | 196 ++++++++
 content/titlepage.html                      |  29 +-
 content/tocpage.html                        |  47 +-
 content/urls_mydoc.txt                      |  16 +
 32 files changed, 2135 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/404.html
----------------------------------------------------------------------
diff --git a/content/404.html b/content/404.html
index 3ae6c33..7e6c3a0 100644
--- a/content/404.html
+++ b/content/404.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -494,7 +519,7 @@ $('#toc').on('click', 'a', function() {
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/algolia_search.json
----------------------------------------------------------------------
diff --git a/content/algolia_search.json b/content/algolia_search.json
index f11b0c9..6b40c36 100644
--- a/content/algolia_search.json
+++ b/content/algolia_search.json
@@ -154,6 +154,32 @@
 
 
 {
+"title": "Recipe 1. Hello Quarks!",
+"tags": "",
+"keywords": "",
+"url": "../recipes/recipe_hello_quarks",
+"summary": "",
+"body": "Quarks' pure Java implementation is a powerful feature which allows it to be run on the majority of JVM-compatible systems. It also has the added benefit of enabling the developer to develop applications entirely within the Eclipse and Intellij ecosystems. For the purposes of this (and future) recipes, it will be assumed that the developer is using Eclipse. To begin the Hello World recipe, create a new project and import the necessary libraries as outlined in the [getting started guide](quarks-getting-started). Next, write the following template application:``` java    public static void main(String[] args) {        DirectProvider dp = new DirectProvider();        Topology top = dp.newTopology();    }```The *DirectProvider* is an object which allows the user to submit and run the final application. It also creates the *Topology* object, which gives the developer the ability to define a stream of strings.## Using Topology.stringsThe primary abstraction in Quarks is the `TStr
 eam`. A *TStream* represents the flow of data in a Quarks application; for example, the periodic floating point readings from a temperature sensor. The data items which are sent through a `TStream` are Java objects -- in the \"Hello Quarks!\" example, we are sending a single java.lang.String. There are a number of ways to create a `TStream`, and `Topology.strings` is the simplest. The user specifies a number of strings which will be used as the stream's data items.``` java    public static void main(String[] args) {        DirectProvider dp = new DirectProvider();        Topology top = dp.newTopology();        TStream helloStream = top.strings(\"Hello Quarks!\");    }```The `helloStream` stream is created, and the \"Hello Quarks!\" string will be sent as its single data item.## Printing to Output`TStream.print` can be used to print the data items of a stream to standard output by invoking the `toString` method of each data item. In this case the data items are already strings, but i
 n principle `TStream.print` can be called on any stream, regardless of the datatype carried by the stream.``` java    public static void main(String[] args) {        DirectProvider dp = new DirectProvider();        Topology top = dp.newTopology();        TStream helloStream = top.strings(\"Hello Quarks!\");        helloStream.print();    }```## Submitting the ApplicationThe only remaining step is to submit the application, which is performed by the `DirectProvider`. Submitting a Quarks application initializes the threads which execute the `Topology`, and begins processing its data sources.``` java    public static void main(String[] args) {        DirectProvider dp = new DirectProvider();        Topology top = dp.newTopology();        TStream helloStream = top.strings(\"Hello Quarks!\");        helloStream.print();        dp.submit(top);    }```After running the application, the output is \"Hello Quarks!\":```Hello Quarks!```"
+
+},
+
+
+
+
+{
+"title": "Recipe 2. Writing a Source Function",
+"tags": "",
+"keywords": "",
+"url": "../recipes/recipe_source_function",
+"summary": "",
+"body": "In the previous [Hello Quarks!](recipe_hello_quarks) example, we create a data source which only generates a single Java String and prints it to output. Yet Quarks sources support the ability generate any data type as a source, not just Java types such as Strings and Doubles. Moreover, because the user supplies the code which generates the data, the user has complete flexibility for *how* the data is generated. This recipe demonstrates how a user could write such a custom data source.## Custom Source: Reading the Lines of a Web Page{{site.data.alerts.note}} Quarks' API provides convenience methods for performing HTTP requests. For the sake of example we are writing a HTTP data source manually, but in principle there are easier methods. {{site.data.alerts.end}}One example of a custom data source could be retrieving the contents of a web page and printing each line to output. For example, the user could be querying the Yahoo Finance website for the most recent stock price dat
 a of Bank of America, Cabot Oil & Gas, and Freeport-McMoRan Inc:``` java    public static void main(String[] args) throws Exception {        DirectProvider dp = new DirectProvider();        Topology top = dp.newTopology();                final URL url = new URL(\"http://finance.yahoo.com/d/quotes.csv?s=BAC+COG+FCX&f=snabl\");    }```Given the correctly formatted URL to request the data, we can use the *Topology.source* method to generate each line of the page as a data item on the stream. `Topology.source` takes a Java Supplier that returns an Iterable. The supplier is invoked once, and the items returned from the Iterable are used as the stream's data items. For example, the following `queryWebsite` method returns a supplier which queries  a URL and returns an Iterable of its contents:``` java    private static Supplier > queryWebsite(URL url) throws Exception{        return () -> {            List lines = new LinkedList();            try {                InputStream is = url.openS
 tream();                BufferedReader br = new BufferedReader(                        new InputStreamReader(is));                                for(String s = br.readLine(); s != null; s = br.readLine())                    lines.add(s);            } catch (Exception e) {                e.printStackTrace();            }            return lines;        };    }``` When invoking `Topology.source`, we can use `queryWebsite` to return the required supplier, passing in the URL.  ``` java     public static void main(String[] args) throws Exception {        DirectProvider dp = new DirectProvider();        Topology top = dp.newTopology();                final URL url = new URL(\"http://finance.yahoo.com/d/quotes.csv?s=BAC+COG+FCX&f=snabl\");                TStream linesOfWebsite = top.source(queryWebsite(url));    } ```  Source methods such as `Topology.source` and `Topology.strings` return a `TStream`. If we print the `linesOfWebsite` stream to standard output and run the application, we c
 an see that it correctly generates the data and feeds it into the Quarks runtime:Output:```java\"BAC\",\"Bank of America Corporation Com\",13.150,13.140,\"12:00pm - 13.145\"\"COG\",\"Cabot Oil & Gas Corporation Com\",21.6800,21.6700,\"12:00pm - 21.6775\"\"FCX\",\"Freeport-McMoRan, Inc. Common S\",8.8200,8.8100,\"12:00pm - 8.8035\"```## Polling source: reading data periodicallyA much more common scenario for a developer is the periodic generation of data from a source operator -- a data source may need to be polled every 5 seconds, 3 hours, or any time frame. To this end, `Topology` exposes the `poll` method which can be used to call a function at the frequency of the user's choosing. For example, a user might want to query Yahoo Finance every two seconds to retrieve the most up to date ticker price for a stock:```java    public static void main(String[] args) throws Exception {        DirectProvider dp = new DirectProvider();        Topology top = dp.newTopology();                fi
 nal URL url = new URL(\"http://finance.yahoo.com/d/quotes.csv?s=BAC+COG+FCX&f=snabl\");                TStream> source = top.poll(queryWebsite(url), 2, TimeUnit.SECONDS);        source.print();                dp.submit(top);    }```**Output:**It's important to note that calls to `DirectProvider.submit` are non-blocking; the main thread will exit, and the threads executing the topology will continue to run. (Also, to see changing stock prices, the above example needs to be run during open trading hours. Otherwise, it will simply return the same results every time the website is polled)."
+
+},
+
+
+
+
+{
 "title": "Sample Programs",
 "tags": "",
 "keywords": "",

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/docs/committers.html
----------------------------------------------------------------------
diff --git a/content/docs/committers.html b/content/docs/committers.html
index b6e2e63..594379b 100644
--- a/content/docs/committers.html
+++ b/content/docs/committers.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -506,7 +531,7 @@ $('#toc').on('click', 'a', function() {
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/docs/common-quarks-operations.html
----------------------------------------------------------------------
diff --git a/content/docs/common-quarks-operations.html b/content/docs/common-quarks-operations.html
index f3e3203..07c8a4d 100644
--- a/content/docs/common-quarks-operations.html
+++ b/content/docs/common-quarks-operations.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -547,7 +572,7 @@ $('#toc').on('click', 'a', function() {
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/docs/community.html
----------------------------------------------------------------------
diff --git a/content/docs/community.html b/content/docs/community.html
index 34834ab..8872a4c 100644
--- a/content/docs/community.html
+++ b/content/docs/community.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -550,7 +575,7 @@ $('#toc').on('click', 'a', function() {
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/docs/console.html
----------------------------------------------------------------------
diff --git a/content/docs/console.html b/content/docs/console.html
index e1d42d7..f655311 100644
--- a/content/docs/console.html
+++ b/content/docs/console.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -969,7 +994,7 @@ The bars that are the tallest and therefore have the highest tuple count are OP_
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/docs/faq.html
----------------------------------------------------------------------
diff --git a/content/docs/faq.html b/content/docs/faq.html
index 63d6daa..f0ae152 100644
--- a/content/docs/faq.html
+++ b/content/docs/faq.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -577,7 +602,7 @@ $('#toc').on('click', 'a', function() {
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/docs/home.html
----------------------------------------------------------------------
diff --git a/content/docs/home.html b/content/docs/home.html
index 29c83b0..42e4f0f 100644
--- a/content/docs/home.html
+++ b/content/docs/home.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -582,7 +607,7 @@ medical device.</li>
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/docs/overview.html
----------------------------------------------------------------------
diff --git a/content/docs/overview.html b/content/docs/overview.html
index 1828ddf..40c9b82 100644
--- a/content/docs/overview.html
+++ b/content/docs/overview.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -566,7 +591,7 @@ medical device.</li>
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/docs/quarks-getting-started.html
----------------------------------------------------------------------
diff --git a/content/docs/quarks-getting-started.html b/content/docs/quarks-getting-started.html
index ab5c767..5dda50e 100644
--- a/content/docs/quarks-getting-started.html
+++ b/content/docs/quarks-getting-started.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -668,7 +693,7 @@ Your environment is set up! You can start writing your first Quarks application.
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/docs/quarks_index.html
----------------------------------------------------------------------
diff --git a/content/docs/quarks_index.html b/content/docs/quarks_index.html
index f374793..c1e65b8 100644
--- a/content/docs/quarks_index.html
+++ b/content/docs/quarks_index.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -524,7 +549,7 @@ $('#toc').on('click', 'a', function() {
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/docs/quickstart.html
----------------------------------------------------------------------
diff --git a/content/docs/quickstart.html b/content/docs/quickstart.html
index 3d6faa4..196cf58 100644
--- a/content/docs/quickstart.html
+++ b/content/docs/quickstart.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -543,7 +568,7 @@ Here we map a stream of random numbers into JSON as the payload for a device eve
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/docs/samples.html
----------------------------------------------------------------------
diff --git a/content/docs/samples.html b/content/docs/samples.html
index 638cfa1..f0d9bc0 100644
--- a/content/docs/samples.html
+++ b/content/docs/samples.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -562,7 +587,7 @@ $('#toc').on('click', 'a', function() {
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/docs/search.html
----------------------------------------------------------------------
diff --git a/content/docs/search.html b/content/docs/search.html
index d7f8748..3ac15bb 100644
--- a/content/docs/search.html
+++ b/content/docs/search.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -484,7 +509,7 @@ $('#toc').on('click', 'a', function() {
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/docs/tag_collaboration.html
----------------------------------------------------------------------
diff --git a/content/docs/tag_collaboration.html b/content/docs/tag_collaboration.html
index a874a5a..da6ccf8 100644
--- a/content/docs/tag_collaboration.html
+++ b/content/docs/tag_collaboration.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -528,6 +553,10 @@ $('#toc').on('click', 'a', function() {
     
    
     
+   
+    
+   
+    
     
 </tbody>
 </table>
@@ -561,7 +590,7 @@ $('#toc').on('click', 'a', function() {
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/docs/tag_content_types.html
----------------------------------------------------------------------
diff --git a/content/docs/tag_content_types.html b/content/docs/tag_content_types.html
index d339699..aac8304 100644
--- a/content/docs/tag_content_types.html
+++ b/content/docs/tag_content_types.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -528,6 +553,10 @@ $('#toc').on('click', 'a', function() {
     
    
     
+   
+    
+   
+    
     
 </tbody>
 </table>
@@ -561,7 +590,7 @@ $('#toc').on('click', 'a', function() {
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/docs/tag_formatting.html
----------------------------------------------------------------------
diff --git a/content/docs/tag_formatting.html b/content/docs/tag_formatting.html
index 9feb6b6..0f33da0 100644
--- a/content/docs/tag_formatting.html
+++ b/content/docs/tag_formatting.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -528,6 +553,10 @@ $('#toc').on('click', 'a', function() {
     
    
     
+   
+    
+   
+    
     
 </tbody>
 </table>
@@ -561,7 +590,7 @@ $('#toc').on('click', 'a', function() {
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/docs/tag_getting_started.html
----------------------------------------------------------------------
diff --git a/content/docs/tag_getting_started.html b/content/docs/tag_getting_started.html
index 197eecf..8ff1005 100644
--- a/content/docs/tag_getting_started.html
+++ b/content/docs/tag_getting_started.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -533,6 +558,10 @@ $('#toc').on('click', 'a', function() {
     
    
     
+   
+    
+   
+    
     
 </tbody>
 </table>
@@ -566,7 +595,7 @@ $('#toc').on('click', 'a', function() {
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/docs/tag_mobile.html
----------------------------------------------------------------------
diff --git a/content/docs/tag_mobile.html b/content/docs/tag_mobile.html
index c6a0852..0987456 100644
--- a/content/docs/tag_mobile.html
+++ b/content/docs/tag_mobile.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -528,6 +553,10 @@ $('#toc').on('click', 'a', function() {
     
    
     
+   
+    
+   
+    
     
 </tbody>
 </table>
@@ -561,7 +590,7 @@ $('#toc').on('click', 'a', function() {
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/docs/tag_navigation.html
----------------------------------------------------------------------
diff --git a/content/docs/tag_navigation.html b/content/docs/tag_navigation.html
index 83b0103..ddc74a3 100644
--- a/content/docs/tag_navigation.html
+++ b/content/docs/tag_navigation.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -528,6 +553,10 @@ $('#toc').on('click', 'a', function() {
     
    
     
+   
+    
+   
+    
     
 </tbody>
 </table>
@@ -561,7 +590,7 @@ $('#toc').on('click', 'a', function() {
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/docs/tag_publishing.html
----------------------------------------------------------------------
diff --git a/content/docs/tag_publishing.html b/content/docs/tag_publishing.html
index 6ba9d78..a29a9e0 100644
--- a/content/docs/tag_publishing.html
+++ b/content/docs/tag_publishing.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -528,6 +553,10 @@ $('#toc').on('click', 'a', function() {
     
    
     
+   
+    
+   
+    
     
 </tbody>
 </table>
@@ -561,7 +590,7 @@ $('#toc').on('click', 'a', function() {
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/docs/tag_single_sourcing.html
----------------------------------------------------------------------
diff --git a/content/docs/tag_single_sourcing.html b/content/docs/tag_single_sourcing.html
index 1552547..31ee066 100644
--- a/content/docs/tag_single_sourcing.html
+++ b/content/docs/tag_single_sourcing.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -528,6 +553,10 @@ $('#toc').on('click', 'a', function() {
     
    
     
+   
+    
+   
+    
     
 </tbody>
 </table>
@@ -561,7 +590,7 @@ $('#toc').on('click', 'a', function() {
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/docs/tag_special_layouts.html
----------------------------------------------------------------------
diff --git a/content/docs/tag_special_layouts.html b/content/docs/tag_special_layouts.html
index bdc11b8..e63a51c 100644
--- a/content/docs/tag_special_layouts.html
+++ b/content/docs/tag_special_layouts.html
@@ -314,6 +314,31 @@ window.location.href = uri;
                 
                 
             
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
             <li><a href="#">Sample Programs</a>
                 <ul>
                     
@@ -528,6 +553,10 @@ $('#toc').on('click', 'a', function() {
     
    
     
+   
+    
+   
+    
     
 </tbody>
 </table>
@@ -561,7 +590,7 @@ $('#toc').on('click', 'a', function() {
             <div class="row">
                 <div class="col-lg-12 footer">
                
- Site last generated: Mar 21, 2016 <br />
+ Site last generated: Mar 22, 2016 <br />
 
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/prince-file-list.txt
----------------------------------------------------------------------
diff --git a/content/prince-file-list.txt b/content/prince-file-list.txt
index 9634bd0..0d0172a 100644
--- a/content/prince-file-list.txt
+++ b/content/prince-file-list.txt
@@ -55,6 +55,20 @@
               
                       
                          
+                            http://quarks.incubator.apache.org/recipes/recipe_hello_quarks.html
+                                  
+                        
+                     
+                         
+                            http://quarks.incubator.apache.org/recipes/recipe_source_function.html
+                                  
+                        
+                     
+              
+          
+              
+                      
+                         
                             http://quarks.incubator.apache.org/docs/samples.html
                                   
                         

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/recipes/images/pollingSource.gif
----------------------------------------------------------------------
diff --git a/content/recipes/images/pollingSource.gif b/content/recipes/images/pollingSource.gif
new file mode 100644
index 0000000..bc979c6
Binary files /dev/null and b/content/recipes/images/pollingSource.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-quarks-website/blob/6d865d4b/content/recipes/recipe_hello_quarks.html
----------------------------------------------------------------------
diff --git a/content/recipes/recipe_hello_quarks.html b/content/recipes/recipe_hello_quarks.html
new file mode 100644
index 0000000..39b69cf
--- /dev/null
+++ b/content/recipes/recipe_hello_quarks.html
@@ -0,0 +1,576 @@
+<!DOCTYPE html>
+  <head>
+
+ <meta charset="utf-8">
+<meta http-equiv="X-UA-Compatible" content="IE=edge">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<meta name="description" content="">
+<meta name="keywords" content=" ">
+<title>Recipe 1. Hello Quarks!  | Quarks Documentation</title>
+<link rel="stylesheet" type="text/css" href="../css/syntax.css">
+<link rel="stylesheet" type="text/css" href="../css/font-awesome.min.css">
+<!--<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">-->
+<link rel="stylesheet" type="text/css" href="../css/modern-business.css">
+<link rel="stylesheet" type="text/css" href="../css/lavish-bootstrap.css">
+<link rel="stylesheet" type="text/css" href="../css/customstyles.css">
+<link rel="stylesheet" type="text/css" href="../css/theme-blue.css">
+<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
+<script src="../js/jquery.navgoco.min.js"></script>
+<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/2.0.0/anchor.min.js"></script>
+<script src="../js/toc.js"></script>
+<script src="../js/customscripts.js"></script>
+<link rel="shortcut icon" href="../common_images/favicon.ico" type="image/x-icon">
+<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
+<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
+<!--[if lt IE 9]>
+<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
+<![endif]-->
+
+
+
+
+
+
+
+ 
+
+<script>
+  $(function () {
+      $('[data-toggle="tooltip"]').tooltip()
+  })
+</script>
+
+
+
+  </head>
+
+<body>
+
+   <!-- Navigation -->
+<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
+    <div class="container topnavlinks">
+        <div class="navbar-header">
+            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
+                <span class="sr-only">Toggle navigation</span>
+                <span class="icon-bar"></span>
+                <span class="icon-bar"></span>
+                <span class="icon-bar"></span>
+            </button>
+
+            <a class="fa fa-home fa-lg navbar-brand" href="home.html">&nbsp;<span class="projectTitle"> Quarks Documentation</span></a>
+
+        </div>
+        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
+            <ul class="nav navbar-nav navbar-right">
+                <!-- entries without drop-downs appear here -->
+                <!-- conditional logic to control which topnav appears for the audience defined in the configuration file.-->
+                
+
+
+
+
+
+
+
+
+                <li class="dropdown">
+                    
+                    
+                    
+                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Github Repos<b class="caret"></b></a>
+                    <ul class="dropdown-menu">
+                        
+                        
+                        
+                        <li><a href="https://github.com/apache/incubator-quarks" target="_blank">Source code</a></li>
+                        
+                        
+                        
+                        
+                        
+                        <li><a href="https://github.com/apache/incubator-quarks-website" target="_blank">Website/Documentation</a></li>
+                        
+                        
+                        
+                        
+
+                    </ul>
+                </li>
+                
+                
+
+
+                
+                
+                
+                
+                <li><a href="https://quarks-edge.github.io/quarks/docs/javadoc/index.html" target="_blank">Javadoc</a></li>
+                
+                
+                
+                
+
+
+                <!-- entries with drop-downs appear here -->
+                <!-- conditional logic to control which topnav appears for the audience defined in the configuration file.-->
+
+                <li class="dropdown">
+                    
+                    
+                    
+                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Quarks Resources<b class="caret"></b></a>
+                    <ul class="dropdown-menu">
+                        
+                        
+                        
+                        <li><a href="https://github.com/apache/incubator-quarks/releases" target="_blank">Download</a></li>
+                        
+                        
+                        
+                        
+                        
+                        <li><a href="samples">Samples</a></li>
+                        
+                        
+                        
+                        
+                        
+                        <li><a href="faq">FAQ</a></li>
+                        
+                        
+                        
+                        
+
+                    </ul>
+                </li>
+                
+                
+
+
+                <!-- special insertion -->
+
+               
+                <!-- Send feedback function -->
+<script>
+function SendLinkByMail(href) {
+var subject= "Quarks Documentation feedback";
+var body = "I have some feedback about the Recipe 1. Hello Quarks! page: ";
+body += window.location.href;
+body += "";
+var uri = "mailto:?subject=";
+uri += encodeURIComponent(subject);
+uri += "&body=";
+uri += encodeURIComponent(body);
+window.location.href = uri;
+}
+</script>
+
+<li><a href="mailto:dev@quarks.incubator.apache.org" target="_blank"><i class="fa fa-envelope-o"></i> Feedback</a></li>
+
+
+                <!--uncomment this block if you want simple search instead of algolia-->
+                <li>
+                     <!--start search-->
+                    <div id="search-demo-container">
+                        <input type="text" id="search-input" placeholder="search...">
+                        <ul id="results-container"></ul>
+                    </div>
+                    <script src="../js/jekyll-search.js" type="text/javascript"></script>
+                    <script type="text/javascript">
+                        SimpleJekyllSearch.init({
+                            searchInput: document.getElementById('search-input'),
+                            resultsContainer: document.getElementById('results-container'),
+                            dataSource: '../search.json',
+                            searchResultTemplate: '<li><a href="{url}" title="Recipe 1. Hello Quarks!">{title}</a></li>',
+                        noResultsText: 'No results found.',
+                                limit: 10,
+                                fuzzy: true,
+                        })
+                    </script>
+                     <!--end search-->
+                </li>
+
+            
+        </div>
+        <!-- /.container -->
+</nav>
+
+
+    <!-- Page Content -->
+    <div class="container">
+        <div class="col-lg-12">&nbsp;</div>
+
+
+<!-- Content Row -->
+<div class="row">
+    <!-- Sidebar Column -->
+    <div class="col-md-3">
+
+        <script>
+
+            $(document).ready(function() {
+                // Initialize navgoco with default options
+                $("#mysidebar").navgoco({
+                    caretHtml: '',
+                    accordion: true,
+                    openClass: 'active', // open
+                    save: false, // leave false or nav highlighting doesn't work right
+                    cookie: {
+                        name: 'navgoco',
+                        expires: false,
+                        path: '/'
+                    },
+                    slide: {
+                        duration: 400,
+                        easing: 'swing'
+                    }
+                });
+
+                $("#collapseAll").click(function(e) {
+                    e.preventDefault();
+                    $("#mysidebar").navgoco('toggle', false);
+                });
+
+                $("#expandAll").click(function(e) {
+                    e.preventDefault();
+                    $("#mysidebar").navgoco('toggle', true);
+                });
+
+            });
+
+        </script>
+
+
+        
+
+
+
+
+
+
+
+
+
+        <ul id="mysidebar" class="nav">
+
+            <span class="siteTagline">Quarks</span>
+            <span class="versionTagline">Version 0.3.0</span>
+
+            
+            
+            
+                
+            
+            <li><a href="#">Overview</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../docs/quarks_index.html">Introduction</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../docs/faq.html">FAQ</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
+            <li><a href="#">Get Started</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../docs/quarks-getting-started.html">1. Getting Started Guide</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../docs/common-quarks-operations.html">2. Common Operations</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
+            <li><a href="#">Quarks Cookbook</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_hello_quarks.html">Recipe 1. Hello Quarks!</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../recipes/recipe_source_function.html">Recipe 2. Writing a Source Function</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
+            <li><a href="#">Sample Programs</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../docs/samples.html">1. Samples</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../docs/quickstart.html">2. Quickstart IBM Watson IoT Platform</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
+            <li><a href="#">Using The Console</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../docs/console.html">1. Using The Console</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+            
+            <li><a href="#">Get involved</a>
+                <ul>
+                    
+                    
+                    
+                    <li><a href="../docs/getinvolved.html">How to participate</a></li>
+                    
+
+                    
+
+                    
+                    
+                    
+                    
+                    <li><a href="../docs/committers.html">Committers</a></li>
+                    
+
+                    
+
+                    
+                    
+                </ul>
+                
+                
+                
+
+
+                <!-- if you aren't using the accordion, uncomment this block:
+
+                     <p class="external">
+                         <a href="#" id="collapseAll">Collapse All</a> | <a href="#" id="expandAll">Expand All</a>
+                     </p>
+                 -->
+				 <br/>
+			</li>
+		</ul>
+		<div class="row">
+		<div class="col-md-12">
+			
+<!-- this handles the automatic toc. use ## for subheads to auto-generate the on-page minitoc. if you use html tags, you must supply an ID for the heading element in order for it to appear in the minitoc. -->
+<script>
+$( document ).ready(function() {
+  // Handler for .ready() called.
+
+$('#toc').toc({ minimumHeaders: 0, listType: 'ul', showSpeed: 0, headers: 'h2,h3,h4' });
+
+/* this offset helps account for the space taken up by the floating toolbar. */
+$('#toc').on('click', 'a', function() {
+  var target = $(this.getAttribute('href'))
+    , scroll_target = target.offset().top
+
+  $(window).scrollTop(scroll_target - 10);
+  return false
+})
+  
+});
+</script>
+
+
+<div id="toc"></div>
+
+		</div>
+	</div>
+	</div>
+	
+    <!-- this highlights the active parent class in the navgoco sidebar. this is critical so that the parent expands when you're viewing a page. This must appear below the sidebar code above. Otherwise, if placed inside customscripts.js, the script runs before the sidebar code runs and the class never gets inserted.-->
+    <script>$("li.active").parents('li').toggleClass("active");</script>
+
+
+            <!-- Content Column -->
+            <div class="col-md-9">
+                
+                <div class="post-header">
+   <h1 class="post-title-main">Recipe 1. Hello Quarks!</h1>
+</div>
+
+<div class="post-content">
+
+   
+
+<!-- this handles the automatic toc. use ## for subheads to auto-generate the on-page minitoc. if you use html tags, you must supply an ID for the heading element in order for it to appear in the minitoc. -->
+<script>
+$( document ).ready(function() {
+  // Handler for .ready() called.
+
+$('#toc').toc({ minimumHeaders: 0, listType: 'ul', showSpeed: 0, headers: 'h2,h3,h4' });
+
+/* this offset helps account for the space taken up by the floating toolbar. */
+$('#toc').on('click', 'a', function() {
+  var target = $(this.getAttribute('href'))
+    , scroll_target = target.offset().top
+
+  $(window).scrollTop(scroll_target - 10);
+  return false
+})
+  
+});
+</script>
+
+
+<div id="toc"></div>
+
+
+    
+
+    <a target="_blank" href="https://github.com/apache/incubator-quarks-website/blob/master/site/recipes/recipe_hello_quarks.md" class="btn btn-default githubEditButton" role="button"><i class="fa fa-github fa-lg"></i> Edit me</a>
+    
+  <p>Quarks&#39; pure Java implementation is a powerful feature which allows it to be run on the majority of JVM-compatible systems. It also has the added benefit of enabling the developer to develop applications entirely within the Eclipse and Intellij ecosystems. For the purposes of this (and future) recipes, it will be assumed that the developer is using Eclipse. To begin the Hello World recipe, create a new project and import the necessary libraries as outlined in the <a href="quarks-getting-started">getting started guide</a>. Next, write the following template application:</p>
+<div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="p">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span>
+        <span class="n">DirectProvider</span> <span class="n">dp</span> <span class="o">=</span> <span class="k">new</span> <span class="n">DirectProvider</span><span class="o">();</span>
+        <span class="n">Topology</span> <span class="n">top</span> <span class="o">=</span> <span class="n">dp</span><span class="o">.</span><span class="na">newTopology</span><span class="o">();</span>
+    <span class="o">}</span>
+</code></pre></div>
+<p>The <em>DirectProvider</em> is an object which allows the user to submit and run the final application. It also creates the <em>Topology</em> object, which gives the developer the ability to define a stream of strings.</p>
+
+<h2 id="using-topology-strings">Using Topology.strings</h2>
+
+<p>The primary abstraction in Quarks is the <code>TStream</code>. A <em>TStream</em> represents the flow of data in a Quarks application; for example, the periodic floating point readings from a temperature sensor. The data items which are sent through a <code>TStream</code> are Java objects -- in the &quot;Hello Quarks!&quot; example, we are sending a single java.lang.String. There are a number of ways to create a <code>TStream</code>, and <code>Topology.strings</code> is the simplest. The user specifies a number of strings which will be used as the stream&#39;s data items.</p>
+<div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="p">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span>
+        <span class="n">DirectProvider</span> <span class="n">dp</span> <span class="o">=</span> <span class="k">new</span> <span class="n">DirectProvider</span><span class="o">();</span>
+        <span class="n">Topology</span> <span class="n">top</span> <span class="o">=</span> <span class="n">dp</span><span class="o">.</span><span class="na">newTopology</span><span class="o">();</span>
+        <span class="n">TStream</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span> <span class="n">helloStream</span> <span class="o">=</span> <span class="n">top</span><span class="o">.</span><span class="na">strings</span><span class="o">(</span><span class="s">"Hello Quarks!"</span><span class="o">);</span>
+    <span class="o">}</span>
+</code></pre></div>
+<p>The <code>helloStream</code> stream is created, and the &quot;Hello Quarks!&quot; string will be sent as its single data item.</p>
+
+<h2 id="printing-to-output">Printing to Output</h2>
+
+<p><code>TStream.print</code> can be used to print the data items of a stream to standard output by invoking the <code>toString</code> method of each data item. In this case the data items are already strings, but in principle <code>TStream.print</code> can be called on any stream, regardless of the datatype carried by the stream.</p>
+<div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="p">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span>
+        <span class="n">DirectProvider</span> <span class="n">dp</span> <span class="o">=</span> <span class="k">new</span> <span class="n">DirectProvider</span><span class="o">();</span>
+        <span class="n">Topology</span> <span class="n">top</span> <span class="o">=</span> <span class="n">dp</span><span class="o">.</span><span class="na">newTopology</span><span class="o">();</span>
+        <span class="n">TStream</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span> <span class="n">helloStream</span> <span class="o">=</span> <span class="n">top</span><span class="o">.</span><span class="na">strings</span><span class="o">(</span><span class="s">"Hello Quarks!"</span><span class="o">);</span>
+        <span class="n">helloStream</span><span class="o">.</span><span class="na">print</span><span class="o">();</span>
+    <span class="o">}</span>
+</code></pre></div>
+<h2 id="submitting-the-application">Submitting the Application</h2>
+
+<p>The only remaining step is to submit the application, which is performed by the <code>DirectProvider</code>. Submitting a Quarks application initializes the threads which execute the <code>Topology</code>, and begins processing its data sources.</p>
+<div class="highlight"><pre><code class="language-java" data-lang="java">    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="p">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span>
+        <span class="n">DirectProvider</span> <span class="n">dp</span> <span class="o">=</span> <span class="k">new</span> <span class="n">DirectProvider</span><span class="o">();</span>
+        <span class="n">Topology</span> <span class="n">top</span> <span class="o">=</span> <span class="n">dp</span><span class="o">.</span><span class="na">newTopology</span><span class="o">();</span>
+        <span class="n">TStream</span><span class="o">&lt;</span><span class="n">String</span><span class="o">&gt;</span> <span class="n">helloStream</span> <span class="o">=</span> <span class="n">top</span><span class="o">.</span><span class="na">strings</span><span class="o">(</span><span class="s">"Hello Quarks!"</span><span class="o">);</span>
+        <span class="n">helloStream</span><span class="o">.</span><span class="na">print</span><span class="o">();</span>
+        <span class="n">dp</span><span class="o">.</span><span class="na">submit</span><span class="o">(</span><span class="n">top</span><span class="o">);</span>
+    <span class="o">}</span>
+</code></pre></div>
+<p>After running the application, the output is &quot;Hello Quarks!&quot;:</p>
+<div class="highlight"><pre><code class="language-" data-lang="">Hello Quarks!
+</code></pre></div>
+
+<div class="tags">
+    
+</div>
+
+<!-- 
+
+    <div id="disqus_thread"></div>
+    <script type="text/javascript">
+        /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
+        var disqus_shortname = 'idrbwjekyll'; // required: replace example with your forum shortname
+
+        /* * * DON'T EDIT BELOW THIS LINE * * */
+        (function() {
+            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+        })();
+    </script>
+    <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+ -->
+
+</div>
+
+
+
+<footer>
+            <div class="row">
+                <div class="col-lg-12 footer">
+               
+ Site last generated: Mar 22, 2016 <br />
+
+                </div>
+            </div>
+</footer>
+            </div><!-- /.row -->
+
+    </div>    <!-- /.container -->
+
+</body>
+
+
+</html>
+