text:
<!DOCTYPE html>

<meta charset="UTF-8">

<title>Autofactura_html.html - RDoc Documentation</title>

<link href="../../../fonts.css" rel="stylesheet">
<link href="../../../rdoc.css" rel="stylesheet">

    Home

    Pages
    Classes
    Methods

  <form action="#" method="get" accept-charset="utf-8">

      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">

  </form>

Pages

Gemfile

Gemfile.lock

MIT-LICENSE

README

Rakefile

autofactura.gemspec

ActiveSupport.html

ApplicationController.html

ApplicationHelper.html

Autofactura.html

Articulo.html

Autofactura.html

Comprobante.html

Concepto.html

Domicilio.html

Impuesto.html

Nota.html

Receptor.html

Remision.html

Serie.html

AutofacturaTest.html

Dummy.html

Application.html

Gemfile.html

Gemfile_lock.html

MIT-LICENSE.html

Object.html

README_rdoc.html

Rakefile.html

autofactura_gemspec.html

fonts.css

index.html

darkfish.js

jquery.js

navigation.js

search.js

search_index.js

searcher.js

autofactura_tasks_rake.html

rdoc.css

Autofactura_html.html

Serie_html.html

Autofactura_html.html

README_rdoc_html.html

index_html.html

darkfish_js.html

jquery_js.html

navigation_js.html

search_index_js.html

search_js.html

searcher_js.html

rdoc_css.html

table_of_contents_html.html

table_of_contents.html

README_rdoc.html

Rakefile.html

application_js.html

application_css.html

config_ru.html

test_log.html

404_html.html

422_html.html

500_html.html

favicon_ico.html

autofactura_tasks.rake

Autofactura.html

Autofactura.html

Serie.html

README_rdoc.html

index.html

darkfish.js

jquery.js

navigation.js

search.js

search_index.js

searcher.js

rdoc.css

table_of_contents.html

README

Rakefile

application.js

application.css

config.ru

test.log

404.html

422.html

500.html

favicon.ico

<!DOCTYPE html>

<html> <head> <meta charset="UTF-8">

<title>Autofactura.html - RDoc Documentation</title>

<link href="../../fonts.css" rel="stylesheet"> <link
href="../../rdoc.css" rel="stylesheet">

<script type="text/javascript">

var rdoc_rel_prefix = "../../";

</script>

<script src="../../js/jquery.js"></script> <script
src="../../js/navigation.js"></script> <script
src="../../js/search_index.js"></script> <script
src="../../js/search.js"></script> <script
src="../../js/searcher.js"></script> <script
src="../../js/darkfish.js"></script>

<body id="top" role="document" class="file"> <nav
role="navigation">

<div id="project-navigation">
  <div id="home-section" role="region" title="Quick navigation" class="nav-section">
<h2>
  <a href="../../index.html" rel="home">Home</a>
</h2>

<div id="table-of-contents-navigation">
  <a href="../../table_of_contents.html#pages">Pages</a>
  <a href="../../table_of_contents.html#classes">Classes</a>
  <a href="../../table_of_contents.html#methods">Methods</a>
</div>

</div>

  <div id="search-section" role="search" class="project-section initially-hidden">
<form action="#" method="get" accept-charset="utf-8">
  <div id="search-field-wrapper">
    <input id="search-field" role="combobox" aria-label="Search"
           aria-autocomplete="list" aria-controls="search-results"
           type="text" name="search" placeholder="Search" spellcheck="false"
           title="Type to search, Up and Down to navigate, Enter to load">
  </div>

  <ul id="search-results" aria-label="Search Results"
      aria-busy="false" aria-expanded="false"
      aria-atomic="false" class="initially-hidden"></ul>
</form>

</div>

</div>

<div id="project-metadata">
  <div id="fileindex-section" class="nav-section">
<h3>Pages</h3>

<ul class="link-list">

  <li><a href="../../Gemfile.html">Gemfile</a>

  <li><a href="../../Gemfile_lock.html">Gemfile.lock</a>

  <li><a href="../../MIT-LICENSE.html">MIT-LICENSE</a>

  <li><a href="../../README_rdoc.html">README</a>

  <li><a href="../../Rakefile.html">Rakefile</a>

  <li><a href="../../autofactura_gemspec.html">autofactura.gemspec</a>

  <li><a href="../../lib/tasks/autofactura_tasks_rake.html">autofactura_tasks.rake</a>

  <li><a href="../../rdoc/Autofactura_html.html">Autofactura.html</a>

  <li><a href="../../rdoc/Autofactura/Autofactura_html.html">Autofactura.html</a>

  <li><a href="../../rdoc/Autofactura/Serie_html.html">Serie.html</a>

  <li><a href="../../rdoc/README_rdoc_html.html">README_rdoc.html</a>

  <li><a href="../../rdoc/index_html.html">index.html</a>

  <li><a href="../../rdoc/js/darkfish_js.html">darkfish.js</a>

  <li><a href="../../rdoc/js/jquery_js.html">jquery.js</a>

  <li><a href="../../rdoc/js/navigation_js.html">navigation.js</a>

  <li><a href="../../rdoc/js/search_js.html">search.js</a>

  <li><a href="../../rdoc/js/search_index_js.html">search_index.js</a>

  <li><a href="../../rdoc/js/searcher_js.html">searcher.js</a>

  <li><a href="../../rdoc/rdoc_css.html">rdoc.css</a>

  <li><a href="../../rdoc/table_of_contents_html.html">table_of_contents.html</a>

  <li><a href="../../test/dummy/README_rdoc.html">README</a>

  <li><a href="../../test/dummy/Rakefile.html">Rakefile</a>

  <li><a href="../../test/dummy/app/assets/javascripts/application_js.html">application.js</a>

  <li><a href="../../test/dummy/app/assets/stylesheets/application_css.html">application.css</a>

  <li><a href="../../test/dummy/config_ru.html">config.ru</a>

  <li><a href="../../test/dummy/log/test_log.html">test.log</a>

  <li><a href="../../test/dummy/public/404_html.html">404.html</a>

  <li><a href="../../test/dummy/public/422_html.html">422.html</a>

  <li><a href="../../test/dummy/public/500_html.html">500.html</a>

  <li><a href="../../test/dummy/public/favicon_ico.html">favicon.ico</a>

</ul>

</div>

</div>

</nav>

<main role="main" aria-label="Page rdoc/Autofactura/Autofactura.html">

<p>&lt;!DOCTYPE html&gt;</p>

<p>&lt;html&gt; &lt;head&gt; &lt;meta
content="text/html; charset=UTF-8"
http-equiv="Content-Type"&gt;</p>

<p>&lt;title&gt;class <a
href="../../Autofactura/Autofactura.html">Autofactura::Autofactura</a>
- Autofactura&lt;/title&gt;</p>

<p>&lt;link type="text/css" media="screen" href="../rdoc.css"
rel="stylesheet"&gt;</p>

<p>&lt;script type="text/javascript"&gt;</p>

<pre>var rdoc_rel_prefix = &quot;../&quot;;</pre>

<p>&lt;/script&gt;</p>

<p>&lt;script type="text/javascript" charset="utf-8"
src="../js/jquery.js"&gt;&lt;/script&gt; &lt;script
type="text/javascript" charset="utf-8"
src="../js/navigation.js"&gt;&lt;/script&gt; &lt;script
type="text/javascript" charset="utf-8"
src="../js/search_index.js"&gt;&lt;/script&gt; &lt;script
type="text/javascript" charset="utf-8"
src="../js/search.js"&gt;&lt;/script&gt; &lt;script
type="text/javascript" charset="utf-8"
src="../js/searcher.js"&gt;&lt;/script&gt; &lt;script
type="text/javascript" charset="utf-8"
src="../js/darkfish.js"&gt;&lt;/script&gt;</p>

<p>&lt;body id="top" class="class"&gt; &lt;nav
id="metadata"&gt;</p>

<pre>&lt;nav id=&quot;home-section&quot;
class=&quot;section&quot;&gt; &lt;h3
class=&quot;section-header&quot;&gt;

&lt;a href=&quot;../index.html&quot;&gt;Home&lt;/a&gt;
&lt;a href=&quot;../table_of_contents.html#classes&quot;&gt;Classes&lt;/a&gt;
&lt;a href=&quot;../table_of_contents.html#methods&quot;&gt;Methods&lt;/a&gt;

&lt;/h3&gt;</pre>

<p>&lt;/nav&gt;</p>

<pre>&lt;nav id=&quot;search-section&quot;
class=&quot;section project-section&quot;
class=&quot;initially-hidden&quot;&gt; &lt;form
action=&quot;#&quot; method=&quot;get&quot;
accept-charset=&quot;utf-8&quot;&gt;

&lt;h3 class=&quot;section-header&quot;&gt;
  &lt;input type=&quot;text&quot; name=&quot;search&quot; placeholder=&quot;Search&quot; id=&quot;search-field&quot;
         title=&quot;Type to search, Up and Down to navigate, Enter to load&quot;&gt;
&lt;/h3&gt;

&lt;/form&gt;

&lt;ul id=&quot;search-results&quot;
class=&quot;initially-hidden&quot;&gt;&lt;/ul&gt;</pre>

<p>&lt;/nav&gt;</p>

<pre>&lt;div id=&quot;file-metadata&quot;&gt;

&lt;nav id=&quot;file-list-section&quot; class=&quot;section&quot;&gt;

&lt;h3 class=&quot;section-header&quot;&gt;Defined
In&lt;/h3&gt; &lt;ul&gt;

&lt;li&gt;lib/autofactura.rb

&lt;/ul&gt;</pre>

<p>&lt;/nav&gt;</p>

<pre>&lt;/div&gt;

&lt;div id=&quot;class-metadata&quot;&gt;

&lt;nav id=&quot;parent-class-section&quot; class=&quot;section&quot;&gt;

&lt;h3
class=&quot;section-header&quot;&gt;Parent&lt;/h3&gt;

&lt;p class=&quot;link&quot;&gt;Object</pre>

<p>&lt;/nav&gt;</p>

<pre>&lt;!– Method Quickref –&gt;</pre>

<p>&lt;nav id="method-list-section"
class="section"&gt;</p>

<pre>&lt;h3
class=&quot;section-header&quot;&gt;Methods&lt;/h3&gt;

&lt;ul class=&quot;link-list&quot;&gt;

&lt;li&gt;&lt;a href=&quot;#method-c-new&quot;&gt;::new&lt;/a&gt;

&lt;li&gt;&lt;a href=&quot;#method-i-series&quot;&gt;#series&lt;/a&gt;

&lt;/ul&gt;</pre>

<p>&lt;/nav&gt;</p>

<pre>&lt;/div&gt;

&lt;div id=&quot;project-metadata&quot;&gt;

&lt;nav id=&quot;fileindex-section&quot; class=&quot;section project-section&quot;&gt;

&lt;h3
class=&quot;section-header&quot;&gt;Pages&lt;/h3&gt;

&lt;ul&gt;

&lt;li class=&quot;file&quot;&gt;&lt;a href=&quot;../README_rdoc.html&quot;&gt;README&lt;/a&gt;

&lt;/ul&gt;</pre>

<p>&lt;/nav&gt;</p>

<pre>  &lt;nav id=&quot;classindex-section&quot;
class=&quot;section project-section&quot;&gt; &lt;h3
class=&quot;section-header&quot;&gt;Class and Module
Index&lt;/h3&gt;

&lt;ul class=&quot;link-list&quot;&gt;

&lt;li&gt;&lt;a href=&quot;../Autofactura.html&quot;&gt;Autofactura&lt;/a&gt;

&lt;li&gt;&lt;a href=&quot;../Autofactura/Autofactura.html&quot;&gt;Autofactura::Autofactura&lt;/a&gt;

&lt;li&gt;&lt;a href=&quot;../Autofactura/Serie.html&quot;&gt;Autofactura::Serie&lt;/a&gt;

&lt;/ul&gt;</pre>

<p>&lt;/nav&gt;</p>

<pre>&lt;/div&gt;</pre>

<p>&lt;/nav&gt;</p>

<p>&lt;div id="documentation"&gt;</p>

<pre class="ruby"><span
class="ruby-operator">&lt;</span><span
class="ruby-identifier">h1</span> <span
class="ruby-identifier">class</span>=<span
class="ruby-string">&quot;class&quot;</span><span
class="ruby-operator">&gt;</span><span
class="ruby-keyword">class</span> <span
class="ruby-constant">Autofactura</span><span
class="ruby-operator">::</span><span
class="ruby-constant">Autofactura</span><span
class="ruby-operator">&lt;</span><span
class="ruby-regexp">/h1&gt;

&lt;div id=&quot;description&quot;
class=&quot;description&quot;&gt; </span></pre>

<p>&lt;p&gt;Clase Principal &lt;a
href="Autofactura.html"&gt;Autofactura&lt;/a&gt;&lt;/p&gt;</p>

<pre>&lt;/div&gt;&lt;!– description –&gt;

&lt;section id=&quot;5Buntitled-5D&quot;
class=&quot;documentation-section&quot;&gt;

&lt;!-- Attributes --&gt;
&lt;section id=&quot;attribute-method-details&quot; class=&quot;method-section section&quot;&gt;
  &lt;h3 class=&quot;section-header&quot;&gt;Attributes&lt;/h3&gt;

  &lt;div id=&quot;attribute-i-sucursal&quot; class=&quot;method-detail&quot;&gt;
    &lt;div class=&quot;method-heading attribute-method-heading&quot;&gt;
      &lt;span class=&quot;method-name&quot;&gt;sucursal&lt;/span&gt;&lt;span
        class=&quot;attribute-access-type&quot;&gt;[RW]&lt;/span&gt;
    &lt;/div&gt;

    &lt;div class=&quot;method-description&quot;&gt;

    &lt;/div&gt;
  &lt;/div&gt;

  &lt;div id=&quot;attribute-i-url&quot; class=&quot;method-detail&quot;&gt;
    &lt;div class=&quot;method-heading attribute-method-heading&quot;&gt;
      &lt;span class=&quot;method-name&quot;&gt;url&lt;/span&gt;&lt;span
        class=&quot;attribute-access-type&quot;&gt;[RW]&lt;/span&gt;
    &lt;/div&gt;

    &lt;div class=&quot;method-description&quot;&gt;

    &lt;/div&gt;
  &lt;/div&gt;

  &lt;div id=&quot;attribute-i-user&quot; class=&quot;method-detail&quot;&gt;
    &lt;div class=&quot;method-heading attribute-method-heading&quot;&gt;
      &lt;span class=&quot;method-name&quot;&gt;user&lt;/span&gt;&lt;span
        class=&quot;attribute-access-type&quot;&gt;[RW]&lt;/span&gt;
    &lt;/div&gt;

    &lt;div class=&quot;method-description&quot;&gt;

    &lt;/div&gt;
  &lt;/div&gt;

&lt;/section&gt;&lt;!-- attribute-method-details --&gt;

&lt;!-- Methods --&gt;

 &lt;section id=&quot;public-class-5Buntitled-5D-method-details&quot; class=&quot;method-section section&quot;&gt;
  &lt;h3 class=&quot;section-header&quot;&gt;Public Class Methods&lt;/h3&gt;

  &lt;div id=&quot;method-c-new&quot; class=&quot;method-detail &quot;&gt;

    &lt;div class=&quot;method-heading&quot;&gt;
      &lt;span class=&quot;method-name&quot;&gt;new&lt;/span&gt;&lt;span
        class=&quot;method-args&quot;&gt;(config = {})&lt;/span&gt;
      &lt;span class=&quot;method-click-advice&quot;&gt;click to toggle source&lt;/span&gt;
    &lt;/div&gt;

    &lt;div class=&quot;method-description&quot;&gt;

      &lt;p&gt;initialize&lt;/p&gt;

      &lt;div class=&quot;method-source-code&quot; id=&quot;new-source&quot;&gt;
        &lt;pre&gt;&lt;span class=&quot;ruby-comment&quot;&gt;# File lib/autofactura.rb, line 12&lt;/span&gt;</pre>

<p>&lt;span class="ruby-keyword"&gt;def&lt;/span&gt;
&lt;span
class="ruby-identifier"&gt;initialize&lt;/span&gt;(&lt;span
class="ruby-identifier"&gt;config&lt;/span&gt; = {})</p>

<pre>&lt;span
class=&quot;ruby-keyword&quot;&gt;self&lt;/span&gt;.&lt;span
class=&quot;ruby-identifier&quot;&gt;url&lt;/span&gt; =
&lt;span
class=&quot;ruby-identifier&quot;&gt;config&lt;/span&gt;[&lt;span
class=&quot;ruby-value&quot;&gt;:url&lt;/span&gt;].&lt;span
class=&quot;ruby-identifier&quot;&gt;blank?&lt;/span&gt;
&lt;span
class=&quot;ruby-operator&quot;&gt;?&lt;/span&gt;
&lt;span class=&quot;ruby-string&quot;&gt;&amp;quot;app.autofactura.com/users/api/&quot;</span>
&lt;span
class=&quot;ruby-operator&quot;&gt;:&lt;/span&gt;
&lt;span
class=&quot;ruby-identifier&quot;&gt;config&lt;/span&gt;[&lt;span
class=&quot;ruby-value&quot;&gt;:url&lt;/span&gt;]
&lt;span
class=&quot;ruby-keyword&quot;&gt;self&lt;/span&gt;.&lt;span
class=&quot;ruby-identifier&quot;&gt;user&lt;/span&gt;
= &lt;span
class=&quot;ruby-identifier&quot;&gt;config&lt;/span&gt;[&lt;span
class=&quot;ruby-value&quot;&gt;:user&lt;/span&gt;].&lt;span
class=&quot;ruby-identifier&quot;&gt;blank?&lt;/span&gt;
&lt;span
class=&quot;ruby-operator&quot;&gt;?&lt;/span&gt;
&lt;span
class=&quot;ruby-string&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;
&lt;span
class=&quot;ruby-operator&quot;&gt;:&lt;/span&gt;
&lt;span
class=&quot;ruby-identifier&quot;&gt;config&lt;/span&gt;[&lt;span
class=&quot;ruby-value&quot;&gt;:user&lt;/span&gt;]
&lt;span
class=&quot;ruby-keyword&quot;&gt;self&lt;/span&gt;.&lt;span
class=&quot;ruby-identifier&quot;&gt;sucursal&lt;/span&gt;
= &lt;span
class=&quot;ruby-identifier&quot;&gt;config&lt;/span&gt;[&lt;span
class=&quot;ruby-value&quot;&gt;:sucursal&lt;/span&gt;].&lt;span
class=&quot;ruby-identifier&quot;&gt;blank?&lt;/span&gt;
&lt;span
class=&quot;ruby-operator&quot;&gt;?&lt;/span&gt;
&lt;span
class=&quot;ruby-string&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;
&lt;span
class=&quot;ruby-operator&quot;&gt;:&lt;/span&gt;
&lt;span
class=&quot;ruby-identifier&quot;&gt;config&lt;/span&gt;[&lt;span
class=&quot;ruby-value&quot;&gt;:sucursal&lt;/span&gt;]</pre>

<p>&lt;span
class="ruby-keyword"&gt;end&lt;/span&gt;&lt;/pre&gt;</p>

<pre>      &lt;/div&gt;&lt;!– new-source –&gt;

  &lt;/div&gt;

&lt;/div&gt;&lt;!-- new-method --&gt;

&lt;/section&gt;&lt;!– public-class-method-details –&gt;

&lt;section id=&quot;public-instance-5Buntitled-5D-method-details&quot; class=&quot;method-section section&quot;&gt;
 &lt;h3 class=&quot;section-header&quot;&gt;Public Instance Methods&lt;/h3&gt;

 &lt;div id=&quot;method-i-series&quot; class=&quot;method-detail &quot;&gt;

   &lt;div class=&quot;method-heading&quot;&gt;
     &lt;span class=&quot;method-name&quot;&gt;series&lt;/span&gt;&lt;span
       class=&quot;method-args&quot;&gt;()&lt;/span&gt;
     &lt;span class=&quot;method-click-advice&quot;&gt;click to toggle source&lt;/span&gt;
   &lt;/div&gt;

   &lt;div class=&quot;method-description&quot;&gt;

     &lt;div class=&quot;method-source-code&quot; id=&quot;series-source&quot;&gt;
       &lt;pre&gt;&lt;span class=&quot;ruby-comment&quot;&gt;# File lib/autofactura.rb, line 20&lt;/span&gt;</pre>

<p>&lt;span class="ruby-keyword"&gt;def&lt;/span&gt;
&lt;span
class="ruby-identifier"&gt;series&lt;/span&gt;</p>

<pre>&lt;span
class=&quot;ruby-identifier&quot;&gt;params&lt;/span&gt;
= {

&lt;span class=&quot;ruby-string&quot;&gt;&#39;data[metodo]&#39;&lt;/span&gt; =&lt;span class=&quot;ruby-operator&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;ruby-string&quot;&gt;&#39;series&#39;&lt;/span&gt;,
&lt;span class=&quot;ruby-string&quot;&gt;&#39;data[userg]&#39;&lt;/span&gt; =&lt;span class=&quot;ruby-operator&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;ruby-keyword&quot;&gt;self&lt;/span&gt;.&lt;span class=&quot;ruby-identifier&quot;&gt;user&lt;/span&gt;,
&lt;span class=&quot;ruby-string&quot;&gt;&#39;data[sucursalg]&#39;&lt;/span&gt; =&lt;span class=&quot;ruby-operator&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;ruby-keyword&quot;&gt;self&lt;/span&gt;.&lt;span class=&quot;ruby-identifier&quot;&gt;sucursal&lt;/span&gt;

} &lt;span
class=&quot;ruby-identifier&quot;&gt;request&lt;/span&gt;
= &lt;span
class=&quot;ruby-constant&quot;&gt;Net&lt;/span&gt;&lt;span
class=&quot;ruby-operator&quot;&gt;::&lt;/span&gt;&lt;span
class=&quot;ruby-constant&quot;&gt;HTTP&lt;/span&gt;.&lt;span
class=&quot;ruby-identifier&quot;&gt;post_form&lt;/span&gt;(&lt;span
class=&quot;ruby-constant&quot;&gt;URI&lt;/span&gt;.&lt;span
class=&quot;ruby-identifier&quot;&gt;parse&lt;/span&gt;(&lt;span
class=&quot;ruby-keyword&quot;&gt;self&lt;/span&gt;.&lt;span
class=&quot;ruby-identifier&quot;&gt;url&lt;/span&gt;),
&lt;span
class=&quot;ruby-identifier&quot;&gt;params&lt;/span&gt;)
&lt;span
class=&quot;ruby-identifier&quot;&gt;puts&lt;/span&gt;
&lt;span
class=&quot;ruby-identifier&quot;&gt;request&lt;/span&gt;.&lt;span
class=&quot;ruby-identifier&quot;&gt;body&lt;/span&gt;
&lt;span
class=&quot;ruby-keyword&quot;&gt;return&lt;/span&gt;
&lt;span
class=&quot;ruby-identifier&quot;&gt;request&lt;/span&gt;</pre>

<p>&lt;span
class="ruby-keyword"&gt;end&lt;/span&gt;&lt;/pre&gt;</p>

<pre>        &lt;/div&gt;&lt;!– series-source –&gt;

    &lt;/div&gt;

  &lt;/div&gt;&lt;!-- series-method --&gt;

&lt;/section&gt;&lt;!-- public-instance-method-details --&gt;

&lt;/section&gt;&lt;!– 5Buntitled-5D –&gt;</pre>

<p>&lt;/div&gt;&lt;!– documentation –&gt;</p>

<p>&lt;footer id="validator-badges"&gt;</p>

<pre>&lt;p&gt;&lt;a
href="http://validator.w3.org/check/referer">[Validate]</a>
&lt;p&gt;Generated by &lt;a href=&quot;github.com/rdoc/rdoc">RDoc</a>
3.12.2. &lt;p&gt;Generated with the &lt;a href=&quot;deveiate.org/projects/Darkfish-Rdoc/">Darkfish
Rdoc Generator&lt;/a&gt; 3.</pre>

<p>&lt;/footer&gt;</p> </main>

<footer id="validator-badges" role="contentinfo">

<p><a href="http://validator.w3.org/check/referer">Validate</a>
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.

</footer>

Validate

Generated by RDoc 4.1.1.

Based on Darkfish by Michael Granger.


text:
class GURL;

namespace media_router {

// An interface for receivers used by WiredDisplayMediaRouteProvider for
// launching presentations on wired displays.
class WiredDisplayPresentationReceiver {
 public:
  WiredDisplayPresentationReceiver() = default;

  WiredDisplayPresentationReceiver(const WiredDisplayPresentationReceiver&) =
      delete;
  WiredDisplayPresentationReceiver& operator=(
      const WiredDisplayPresentationReceiver&) = delete;

  virtual ~WiredDisplayPresentationReceiver() = default;

  // Starts a presentation with the given ID and URL.
  virtual void Start(const std::string& presentation_id,
                     const GURL& start_url) = 0;

  // Terminates the presentation.
  virtual void Terminate() = 0;

  // Exits fullscreen and shows the receiver in windowed mode.
  virtual void ExitFullscreen() = 0;
};

}  // namespace media_router

#endif  // CHROME_BROWSER_MEDIA_ROUTER_PROVIDERS_WIRED_DISPLAY_WIRED_DISPLAY_PRESENTATION_RECEIVER_H_

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Doctrine\ODM\MongoDB\Mapping\Annotations;

/**
 * Use this field to store distance information for geoNear queries
 *
 * @Annotation
 */
final class Distance extends AbstractField
{
    public $distance = true;
}


text:
package io.undertow.server.handlers.proxy.mod_cluster;

import java.io.IOException;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

import io.undertow.client.UndertowClient;
import io.undertow.server.HttpHandler;
import io.undertow.server.handlers.ResponseCodeHandler;
import io.undertow.server.handlers.proxy.ProxyHandler;
import org.xnio.OptionMap;
import org.xnio.XnioWorker;
import org.xnio.ssl.XnioSsl;

/**
 * @author Emanuel Muckenhuber
 */
public class ModCluster {

    private static final HttpHandler NEXT_HANDLER = ResponseCodeHandler.HANDLE_404;

    // Health check intervals
    private final long healthCheckInterval;
    private final long removeBrokenNodes;
    private final NodeHealthChecker healthChecker;

    // Proxy connection pool defaults
    private final int maxConnections;
    private final int cacheConnections;
    private final int requestQueueSize;
    private final boolean queueNewRequests;
    private final int maxRequestTime;
    private final long ttl;
    private final boolean useAlias;

    private final XnioWorker xnioWorker;
    private final ModClusterContainer container;
    private final int maxRetries;
    private final boolean deterministicFailover;

    private final boolean reuseXForwarded;

    private final String serverID = UUID.randomUUID().toString(); // TODO

    ModCluster(Builder builder) {
        this.xnioWorker = builder.xnioWorker;
        this.maxConnections = builder.maxConnections;
        this.cacheConnections = builder.cacheConnections;
        this.requestQueueSize = builder.requestQueueSize;
        this.queueNewRequests = builder.queueNewRequests;
        this.healthCheckInterval = builder.healthCheckInterval;
        this.removeBrokenNodes = builder.removeBrokenNodes;
        this.deterministicFailover = builder.deterministicFailover;
        this.healthChecker = builder.healthChecker;
        this.maxRequestTime = builder.maxRequestTime;
        this.ttl = builder.ttl;
        this.useAlias = builder.useAlias;
        this.maxRetries = builder.maxRetries;
        this.reuseXForwarded = builder.reuseXForwarded;
        this.container = new ModClusterContainer(this, builder.xnioSsl, builder.client, builder.clientOptions);
    }

    protected String getServerID() {
        return serverID;
    }

    protected ModClusterContainer getContainer() {
        return container;
    }

    public ModClusterController getController() {
        return container;
    }

    public int getMaxConnections() {
        return maxConnections;
    }

    public int getCacheConnections() {
        return cacheConnections;
    }

    public int getRequestQueueSize() {
        return requestQueueSize;
    }

    public boolean isQueueNewRequests() {
        return queueNewRequests;
    }

    public long getHealthCheckInterval() {
        return healthCheckInterval;
    }

    public long getRemoveBrokenNodes() {
        return removeBrokenNodes;
    }

    public NodeHealthChecker getHealthChecker() {
        return healthChecker;
    }

    public long getTtl() {
        return ttl;
    }

    public boolean isUseAlias() {
        return useAlias;
    }

    public boolean isDeterministicFailover() {
        return deterministicFailover;
    }

    /**
     * Get the handler proxying the requests.
     *
     * @return the proxy handler
     */
    @Deprecated
    public HttpHandler getProxyHandler() {
        return createProxyHandler();
    }
    /**
     * Get the handler proxying the requests.
     *
     * @return the proxy handler
     */
    public HttpHandler createProxyHandler() {
        return ProxyHandler.builder()
                .setProxyClient(container.getProxyClient())
                .setMaxRequestTime(maxRequestTime)
                .setMaxConnectionRetries(maxRetries)
                .setReuseXForwarded(reuseXForwarded)
                .build();
    }

    /**
     * Get the handler proxying the requests.
     *
     * @return the proxy handler
     */
    public HttpHandler createProxyHandler(HttpHandler next) {
        return ProxyHandler.builder()
                .setProxyClient(container.getProxyClient())
                .setNext(next)
                .setMaxRequestTime(maxRequestTime)
                .setMaxConnectionRetries(maxRetries)
                .setReuseXForwarded(reuseXForwarded)
                .build();
    }
    /**
     * Start
     */
    public synchronized void start() {

    }

    /**
     * Start advertising a mcmp handler.
     *
     * @param config the mcmp handler config
     * @throws IOException
     */
    public synchronized void advertise(MCMPConfig config) throws IOException {
        final MCMPConfig.AdvertiseConfig advertiseConfig = config.getAdvertiseConfig();
        if (advertiseConfig == null) {
            throw new IllegalArgumentException("advertise not enabled");
        }
        MCMPAdvertiseTask.advertise(container, advertiseConfig, xnioWorker);
    }

    /**
     * Stop
     */
    public synchronized void stop() {

    }

    public static Builder builder(final XnioWorker worker) {
        return builder(worker, UndertowClient.getInstance(), null);
    }

    public static Builder builder(final XnioWorker worker, final UndertowClient client) {
        return builder(worker, client, null);
    }

    public static Builder builder(final XnioWorker worker, final UndertowClient client, final XnioSsl xnioSsl) {
        return new Builder(worker, client, xnioSsl);
    }

    public static class Builder {

        private final XnioSsl xnioSsl;
        private final UndertowClient client;
        private final XnioWorker xnioWorker;

        // Fairly restrictive connection pool defaults
        private int maxConnections = 16;
        private int cacheConnections = 1;
        private int requestQueueSize = 0;
        private boolean queueNewRequests = false;

        private int maxRequestTime = -1;
        private long ttl = TimeUnit.SECONDS.toMillis(60);
        private boolean useAlias = false;

        private NodeHealthChecker healthChecker = NodeHealthChecker.NO_CHECK;
        private long healthCheckInterval = TimeUnit.SECONDS.toMillis(10);
        private long removeBrokenNodes = TimeUnit.MINUTES.toMillis(1);
        private OptionMap clientOptions = OptionMap.EMPTY;
        private int maxRetries;
        private boolean deterministicFailover = false;

        private boolean reuseXForwarded;

        private Builder(XnioWorker xnioWorker, UndertowClient client, XnioSsl xnioSsl) {
            this.xnioSsl = xnioSsl;
            this.client = client;
            this.xnioWorker = xnioWorker;
        }

        public ModCluster build() {
            return new ModCluster(this);
        }

        public Builder setMaxRequestTime(int maxRequestTime) {
            this.maxRequestTime = maxRequestTime;
            return this;
        }

        public Builder setHealthCheckInterval(long healthCheckInterval) {
            this.healthCheckInterval = healthCheckInterval;
            return this;
        }

        public Builder setRemoveBrokenNodes(long removeBrokenNodes) {
            this.removeBrokenNodes = removeBrokenNodes;
            return this;
        }

        public Builder setMaxConnections(int maxConnections) {
            this.maxConnections = maxConnections;
            return this;
        }

        public Builder setCacheConnections(int cacheConnections) {
            this.cacheConnections = cacheConnections;
            return this;
        }

        public Builder setRequestQueueSize(int requestQueueSize) {
            this.requestQueueSize = requestQueueSize;
            return this;
        }

        public Builder setQueueNewRequests(boolean queueNewRequests) {
            this.queueNewRequests = queueNewRequests;
            return this;
        }

        public Builder setHealthChecker(NodeHealthChecker healthChecker) {
            this.healthChecker = healthChecker;
            return this;
        }

        public Builder setUseAlias(boolean useAlias) {
            this.useAlias = useAlias;
            return this;
        }

        public Builder setMaxRetries(int maxRetries) {
            this.maxRetries = maxRetries;
            return this;
        }

        public Builder setDeterministicFailover(boolean deterministicFailover) {
            this.deterministicFailover = deterministicFailover;
            return this;
        }

        public Builder setTtl(long ttl) {
            this.ttl = ttl;
            return this;
        }

        public Builder setClientOptions(OptionMap clientOptions) {
            this.clientOptions = clientOptions;
            return this;
        }

        public Builder setReuseXForwarded(boolean reuseXForwarded) {
            this.reuseXForwarded = reuseXForwarded;
            return this;
        }
    }

}


text:
"""Automatically setup docs for a project

Call from command line:

	bench setup-docs app path

"""
from __future__ import unicode_literals, print_function

import os, json, frappe, shutil
from frappe.utils import markdown

class setup_docs(object):
	def __init__(self, app, target_app):
		"""Generate source templates for models reference and module API
			and templates at `templates/autodoc`
		"""
		self.app = app
		self.target_app = target_app

		frappe.flags.web_pages_folders = ['docs',]
		frappe.flags.web_pages_apps = [self.app,]

		self.hooks = frappe.get_hooks(app_name = self.app)
		self.app_title = self.hooks.get("app_title")[0]
		self.setup_app_context()

	def setup_app_context(self):
		self.docs_config = frappe.get_module(self.app + ".config.docs")
		version = get_version(app=self.app)
		self.app_context =  {
			"app": frappe._dict({
				"name": self.app,
				"title": self.app_title,
				"description": self.hooks.get("app_description")[0],
				"version": version,
				"publisher": self.hooks.get("app_publisher")[0],
				"icon": self.hooks.get("app_icon")[0],
				"email": self.hooks.get("app_email")[0],
				"source_link": self.docs_config.source_link,
				"license": self.hooks.get("app_license")[0],
				"branch": getattr(self.docs_config, "branch", None) or "develop",
			}),
			"metatags": {
				"description": self.hooks.get("app_description")[0],
			},
			"get_doctype_app": frappe.get_doctype_app
		}

	def build(self, docs_version):
		"""Build templates for docs models and Python API"""
		self.docs_path = frappe.get_app_path(self.target_app, 'www', "docs")
		self.path = os.path.join(self.docs_path, docs_version)
		self.app_context["app"]["docs_version"] = docs_version

		self.app_title = self.hooks.get("app_title")[0]
		self.app_path = frappe.get_app_path(self.app)

		print("Deleting current...")
		shutil.rmtree(self.path, ignore_errors = True)
		os.makedirs(self.path)

		self.make_home_pages()

		for basepath, folders, files in os.walk(self.app_path):

			# make module home page
			if "/doctype/" not in basepath and "doctype" in folders:
				module = os.path.basename(basepath)

				module_folder = os.path.join(self.models_base_path, module)

				self.make_folder(module_folder,
					template = "templates/autodoc/module_home.html",
					context = {"name": module})
				self.update_index_txt(module_folder)

			# make for model files
			if "/doctype/" in basepath:
				parts = basepath.split("/")
				#print parts
				module, doctype = parts[-3], parts[-1]

				if doctype != "boilerplate":
					self.write_model_file(basepath, module, doctype)

			# standard python module
			if self.is_py_module(basepath, folders, files):
				self.write_modules(basepath, folders, files)

		#self.build_user_docs()
		self.copy_user_assets()
		self.add_sidebars()
		self.add_breadcrumbs_for_user_pages()

	def add_breadcrumbs_for_user_pages(self):
		for basepath, folders, files in os.walk(os.path.join(self.docs_path,
			'user')): # pylint: disable=unused-variable
			for fname in files:
				if fname.endswith('.md') or fname.endswith('.html'):
					add_breadcrumbs_tag(os.path.join(basepath, fname))

	def add_sidebars(self):
		'''Add _sidebar.json in each folder in docs'''
		for basepath, folders, files in os.walk(self.docs_path): # pylint: disable=unused-variable
			with open(os.path.join(basepath, '_sidebar.json'), 'w') as sidebarfile:
				sidebarfile.write(frappe.as_json([
					{"title": "Search Docs ...", "type": "input", "route": "/search_docs"},
					{"title": "Docs Home", "route": "/docs"},
					{"title": "User Guide", "route": "/docs/user"},
					{"title": "Server API", "route": "/docs/current/api"},
					{"title": "Models (Reference)", "route": "/docs/current/models"},
					{"title": "Improve Docs", "route":
						"{0}/tree/develop/{1}/docs".format(self.docs_config.source_link, self.app)}
				]))

	def copy_user_assets(self):
		'''Copy docs/user and docs/assets to the target app'''
		print('Copying docs/user and docs/assets...')
		shutil.rmtree(os.path.join(self.docs_path, 'user'),
			ignore_errors=True)
		shutil.rmtree(os.path.join(self.docs_path, 'assets'),
			ignore_errors=True)
		shutil.copytree(os.path.join(self.app_path, 'docs', 'user'),
			os.path.join(self.docs_path, 'user'))
		shutil.copytree(os.path.join(self.app_path, 'docs', 'assets'),
			frappe.get_app_path(self.target_app, 'www', 'docs', 'assets'))

		# copy index
		shutil.copy(os.path.join(self.app_path, 'docs', 'index.md'),
			frappe.get_app_path(self.target_app, 'www', 'docs'))

	def make_home_pages(self):
		"""Make standard home pages for docs, developer docs, api and models
			from templates"""
		# make dev home page
		with open(os.path.join(self.path, "index.html"), "w") as home:
			home.write(frappe.render_template("templates/autodoc/dev_home.html",
			self.app_context))

		# make folders
		self.models_base_path = os.path.join(self.path, "models")
		self.make_folder(self.models_base_path,
			template = "templates/autodoc/models_home.html")

		self.api_base_path = os.path.join(self.path, "api")
		self.make_folder(self.api_base_path,
			template = "templates/autodoc/api_home.html")

		# make /user
		user_path = os.path.join(self.docs_path, "user")
		if not os.path.exists(user_path):
			os.makedirs(user_path)

		# make /assets/img
		img_path = os.path.join(self.docs_path, "assets", "img")
		if not os.path.exists(img_path):
			os.makedirs(img_path)

	def build_user_docs(self):
		"""Build templates for user docs pages, if missing."""
		#user_docs_path = os.path.join(self.docs_path, "user")

		# license
		with open(os.path.join(self.app_path, "..", "license.txt"), "r") as license_file:
			self.app_context["license_text"] = markdown(license_file.read())
			html = frappe.render_template("templates/autodoc/license.html",
				context = self.app_context)

		with open(os.path.join(self.docs_path, "license.html"), "wb") as license_file:
			license_file.write(html.encode("utf-8"))

		# contents
		shutil.copy(os.path.join(frappe.get_app_path("frappe", "templates", "autodoc",
			"contents.html")), os.path.join(self.docs_path, "contents.html"))

		shutil.copy(os.path.join(frappe.get_app_path("frappe", "templates", "autodoc",
			"contents.py")), os.path.join(self.docs_path, "contents.py"))

		# install
		html = frappe.render_template("templates/autodoc/install.md",
			context = self.app_context)

		with open(os.path.join(self.docs_path, "install.md"), "w") as f:
			f.write(html)

		self.update_index_txt(self.docs_path)

	def is_py_module(self, basepath, folders, files):
		return "__init__.py" in files \
			and (not "/doctype" in basepath) \
			and (not "/patches" in basepath) \
			and (not "/change_log" in basepath) \
			and (not "/report" in basepath) \
			and (not "/page" in basepath) \
			and (not "/templates" in basepath) \
			and (not "/tests" in basepath) \
			and (not "/docs" in basepath)

	def write_modules(self, basepath, folders, files):
		module_folder = os.path.join(self.api_base_path, os.path.relpath(basepath, self.app_path))
		self.make_folder(module_folder)

		for f in files:
			if f.endswith(".py"):
				full_module_name = os.path.relpath(os.path.join(basepath, f),
					self.app_path)[:-3].replace("/", ".")

				module_name = full_module_name.replace(".__init__", "")

				module_doc_path = os.path.join(module_folder,
					self.app + "." + module_name + ".html")

				self.make_folder(basepath)

				if not os.path.exists(module_doc_path):
					print("Writing " + module_doc_path)
					with open(module_doc_path, "wb") as f:
						context = {"name": self.app + "." + module_name}
						context.update(self.app_context)
						context['full_module_name'] = self.app + '.' + full_module_name
						f.write(frappe.render_template("templates/autodoc/pymodule.html",
							context).encode('utf-8'))

		self.update_index_txt(module_folder)

	def make_folder(self, path, template=None, context=None):
		if not template:
			template = "templates/autodoc/package_index.html"

		if not os.path.exists(path):
			os.makedirs(path)

			index_txt_path = os.path.join(path, "index.txt")
			print("Writing " + index_txt_path)
			with open(index_txt_path, "w") as f:
				f.write("")

			index_html_path = os.path.join(path, "index.html")
			if not context:
				name = os.path.basename(path)
				if name==".":
					name = self.app
				context = {
					"title": name
				}
			context.update(self.app_context)
			print("Writing " + index_html_path)
			with open(index_html_path, "w") as f:
				f.write(frappe.render_template(template, context))

	def update_index_txt(self, path):
		index_txt_path = os.path.join(path, "index.txt")
		pages = filter(lambda d: ((d.endswith(".html") or d.endswith(".md")) and d not in ("index.html",)) \
			or os.path.isdir(os.path.join(path, d)), os.listdir(path))
		pages = [d.rsplit(".", 1)[0] for d in pages]

		index_parts = []
		if os.path.exists(index_txt_path):
			with open(index_txt_path, "r") as f:
				index_parts = filter(None, f.read().splitlines())

		if not set(pages).issubset(set(index_parts)):
			print("Updating " + index_txt_path)
			with open(index_txt_path, "w") as f:
				f.write("\n".join(pages))

	def write_model_file(self, basepath, module, doctype):
		model_path = os.path.join(self.models_base_path, module, doctype + ".html")

		if not os.path.exists(model_path):
			model_json_path = os.path.join(basepath, doctype + ".json")
			if os.path.exists(model_json_path):
				with open(model_json_path, "r") as j:
					doctype_real_name = json.loads(j.read()).get("name")

				print("Writing " + model_path)

				with open(model_path, "wb") as f:
					context = {"doctype": doctype_real_name}
					context.update(self.app_context)
					f.write(frappe.render_template("templates/autodoc/doctype.html",
						context).encode("utf-8"))

def get_version(app="frappe"):
	try:
		return frappe.get_attr(app + ".__version__")
	except AttributeError:
		return '0.0.1'

edit_link = '''

			Improve this page

'''

def add_breadcrumbs_tag(path):
	with open(path, 'r') as f:
		content = frappe.as_unicode(f.read())
	with open(path, 'wb') as f:
		f.write(('\n' + content).encode('utf-8'))


text:
package httptimeout

import (
	"crypto/tls"
	"net"
	"net/http"
	"time"
)

// Conn wraps a net.Conn, and sets a deadline for every read
// and write operation.
type Conn struct {
	net.Conn
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
}

// Read wraps the net.Conn's original Read method.
func (c *Conn) Read(b []byte) (int, error) {
	err := c.Conn.SetReadDeadline(time.Now().Add(c.ReadTimeout))
	if err != nil {
		return 0, err
	}
	return c.Conn.Read(b)
}

// Write wraps the net.Conn's original Write method.
func (c *Conn) Write(b []byte) (int, error) {
	err := c.Conn.SetWriteDeadline(time.Now().Add(c.WriteTimeout))
	if err != nil {
		return 0, err
	}
	return c.Conn.Write(b)
}

// NewTransport returns http/Transport instance with timeout support
func NewTransport(addr string, readTimeout, writeTimeout time.Duration) *http.Transport {
	t := &http.Transport{}
	t.Dial = func(network, addr string) (net.Conn, error) {
		conn, err := net.DialTimeout(network, addr, readTimeout)
		if err != nil {
			return nil, err
		}
		tc := &Conn{
			Conn:         conn,
			ReadTimeout:  readTimeout,
			WriteTimeout: writeTimeout,
		}
		return tc, nil
	}
	return t
}

// Listener wraps a net.Listener, and gives a place to store the timeout
// parameters. On Accept, it will wrap the net.Conn with our own Conn for us.
type Listener struct {
	net.Listener
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
}

// Accept wraps the Accept method of the original Listener. It waits for the next call and returns
// a Conn which wraps the net.Conn with timeout.
func (l *Listener) Accept() (net.Conn, error) {
	c, err := l.Listener.Accept()
	if err != nil {
		return nil, err
	}
	tc := &Conn{
		Conn:         c,
		ReadTimeout:  l.ReadTimeout,
		WriteTimeout: l.WriteTimeout,
	}
	return tc, nil
}

// NewListener runs net.Listen and announces on the network address addr with timeout.
// The network net must be a stream-oriented network: "tcp", "tcp4", "tcp6", "unix" or "unixpacket".
// For TCP and UDP, the syntax of addr is "host:port", like "127.0.0.1:8080".
// If host is omitted, as in ":8080", Listen listens on all available interfaces instead of just the interface with the
// given host address.
func NewListener(network, addr string, readTimeout, writeTimeout time.Duration) (net.Listener, error) {
	conn, err := net.Listen(network, addr)
	if err != nil {
		return nil, err
	}

	tl := &Listener{
		Listener:     conn,
		ReadTimeout:  readTimeout,
		WriteTimeout: writeTimeout,
	}
	return tl, nil
}

// NewListenerTLS is just a TLS enabled version of NewListener.
func NewListenerTLS(network, addr, certFile, keyFile string, readTimeout, writeTimeout time.Duration) (net.Listener, error) {
	config := &tls.Config{}
	if config.NextProtos == nil {
		config.NextProtos = []string{"http/1.1"}
	}

	var err error
	config.Certificates = make([]tls.Certificate, 1)
	config.Certificates[0], err = tls.LoadX509KeyPair(certFile, keyFile)
	if err != nil {
		return nil, err
	}

	conn, err := net.Listen(network, addr)
	if err != nil {
		return nil, err
	}
	tl := &Listener{
		Listener:     tls.NewListener(conn, config),
		ReadTimeout:  readTimeout,
		WriteTimeout: writeTimeout,
	}
	return tl, nil
}


text:
Pictures to base64 encoded strings bulk converter. Speeds up CSS development, preparing **background-image properties** with base64 encoded pictures.
![Example](https://raw.githubusercontent.com/RobertoPrevato/Base64/master/docs/images/generated-css.png)

**Features**:
- Allows to bulk convert pictures found under a given path, packing base64 encoded strings inside CSS or CSV
- Supports conversion of png, jpg, gif (also animated gif), svg
- Console application with documented interface (includes *--help*)
- Cross platform: being in Python, it can run on Linux, Windows and Mac

**Repository structure**:
- The **source** folder contains the Python source code.
- This code can be executed by both Python 2.x and Python 3.x.
- The **source** folder also contains a setup.py file used with cx_Freeze to generate the executables.
- The **docs** folder contains information used for this documentation.

Commands
--------------
- -h --help displays the help for the console application
- -p / --path *path* [-m / --mode *mode {css,csv}*] starting from the given folder path, recursively looks for pictures, and generates a single file containing the base64 encoded pictures.


text:
namespace AnimalHierarchy
{
    using System;

    public class Dog : Animal, ISound
    {
        public Dog(string name, GEnder gender, int age, string breed)
            : base(name, gender, age)
        {
            this.Breed = breed;
        }

        public string Breed { get; private set; }

        public override void MakeSound()
        {
            Console.WriteLine("{0} is barking", this.Name);
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>tableimix</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="tableikt.html" title="tableikt" />
    <link rel="next" href="tableiw.html" title="tableiw" />

          tableimix

          Prev
          Orchestra Opcodes and Operators
           Next

          tableimix

tableimix —
      Mixes two tables.

Description

      Mixes two tables.

Syntax

tableimix idft, idoff, ilen, is1ft, is1off, is1g, is2ft, is2off, is2g

Initialization

      idft -- Destination function table.

      idoff -- Offset to start writing from. Can be negative.

      ilen -- Number of write operations to perform. Negative means work backwards.

      is1ft, is2ft -- Source function tables. These can be the same as the destination table, if care is exercised about direction of copying data.

      is1off, is2off -- Offsets to start reading from in source tables.

      is1g, is2g -- Gains to apply when reading from the source tables. The results are added and the sum is written to the destination table.

Performance

      tableimix -- This opcode mixes from two tables, with separate gains into the destination table. Writing is done for ilen locations, usually stepping forward through the table - if ilen is positive. If it is negative, then the writing and reading order is backwards - towards lower indexes in the tables. This bi-directional option makes it easy to shift the contents of a table sideways by reading from it and writing back to it with a different offset.

      If ilen is 0, no writing occurs. Note that the internal integer value of ilen is derived from the ANSI C floor() function - which returns the next most negative integer. Hence a fractional negative ilen value of -2.3 would create an internal length of 3, and cause the copying to start from the offset locations and proceed for two locations to the left.

      The total index for table reading and writing is calculated from the starting offset for each table, plus the index value, which starts at 0 and then increments (or decrements) by 1 as mixing proceeds.

      These total indexes can potentially be very large, since there is no restriction on the offset or the ilen. However each total index for each table is ANDed with a length mask (such as 0000 0111 for a table of length 8) to form a final index which is actually used for reading or writing. So no reading or writing can occur outside the tables. This is the same as "wrap" mode in table read and write. These opcodes do not read or write the guardpoint. If a table has been rewritten with one of these, then if it has a guardpoint which is supposed to contain the same value as the location 0, then call tableigpw afterwards.

      The indexes and offsets are all in table steps - they are not normalized to 0 - 1. So for a table of length 256, ilen should be set to 256 if all the table was to be read or written.

      The tables do not need to be the same length - wrapping occurs individually for each table.

Examples

      Here is an example of the tableimix opcode. It uses the file tableimix.csd.

            Example 934. Example of the tableimix opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac   ;;;realtime audio out
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o tableimix.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 2
0dbfs  = 1

gisine ftgen 1, 0, 256, 10, 1, 0, 0, .4		;sinoid
gisaw  ftgen 2, 0, 1024, 7, 0, 256, 1		;saw
gimix  ftgen 100, 0, 256, 7, 0, 256, 1		;used to mix

instr 1

      tableimix 100, 0, 256, 1, 0, 1, 2, 0, .5
asig  poscil .5, 110, gimix			;mix table 1 & 2
      outs   asig, asig

endin
</CsInstruments>
<CsScore>

i1 0 5
e
</CsScore>
</CsoundSynthesizer>

See Also

      tablecopy,
      tablegpw,
      tablemix,
      tableicopy,
      tableigpw

Credits

            Author: Robin Whittle

            Australia

            May 1997

New in version 3.47

          Prev

            Up

           Next

          tableikt

            Home

           tableiw


text:
from __future__ import print_function

from awesome_thirdparty_library import AwesomeClass
import Pyro4

# create adapter class that only exposes what should be accessible,
# and calls into the library class from there:

class AwesomeAdapterClass(AwesomeClass):
    @Pyro4.expose
    def method(self, arg):
        print("Adapter class is called...")
        return super(AwesomeAdapterClass, self).method(arg)

    @Pyro4.expose
    def weird(self):
        result = super(AwesomeAdapterClass, self).weird()
        # we have full control over what is returned and can turn the custom
        # result class into a normal string value that has no issues traveling over the wire
        return "weird " + result.value

with Pyro4.Daemon() as daemon:
    # register the adapter class instead of the library class itself:
    uri = daemon.register(AwesomeAdapterClass, "example.thirdpartylib")
    print("adapter class registered, uri: ", uri)
    daemon.requestLoop()


text:
<resources>
  <string name="app_name">ViewHolders Demo</string>
  <string name="add">Add</string>
  <string name="remove">Remove</string>
  <string name="shuffle">Shuffle</string>
</resources>


text:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".activities.MainActivity">

    <include layout="@layout/content_layout" />

    <android.support.design.widget.NavigationView
        android:id="@+id/navview"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        android:background="@color/backgroundCustom"
        android:layout_gravity="start"
        app:headerLayout="@layout/drawer_header"
        app:itemTextColor="@drawable/drawer_color_selector"
        app:itemIconTint="@drawable/drawer_color_selector"
        app:menu="@menu/menu_navview" />

</android.support.v4.widget.DrawerLayout>


text:
# Release Notes

- [Support Policy](#support-policy)
- [Laravel 5.1.11](#laravel-5.1.11)
- [Laravel 5.1.4](#laravel-5.1.4)
- [Laravel 5.1](#laravel-5.1)
- [Laravel 5.0](#laravel-5.0)
- [Laravel 4.2](#laravel-4.2)
- [Laravel 4.1](#laravel-4.1)

## Support Policy

For LTS releases, such as Laravel 5.1, bug fixes are provided for 2 years and security fixes are provided for 3 years. These releases provide the longest window of support and maintenance.

For general releases, bug fixes are provided for 6 months and security fixes are provided for 1 year.

## Laravel 5.1.11

Laravel 5.1.11 introduces [authorization](/{{version}}/authorization) support out of the box! Conveniently organize your application's authorization logic using simple callbacks or policy classes, and authorize actions using simple, expressive methods.

For more information, please refer to the [authorization documentation](/{{version}}/authorization).

## Laravel 5.1.4

Laravel 5.1.4 introduces simple login throttling to the framework. Consult the [authentication documentation](/{{version}}/authentication#authentication-throttling) for more information.

## Laravel 5.1

Laravel 5.1 continues the improvements made in Laravel 5.0 by adopting PSR-2 and adding event broadcasting, middleware parameters, Artisan improvements, and more.

### PHP 5.5.9+

Since PHP 5.4 will enter "end of life" in September and will no longer receive security updates from the PHP development team, Laravel 5.1 requires PHP 5.5.9 or greater. PHP 5.5.9 allows compatibility with the latest versions of popular PHP libraries such as Guzzle and the AWS SDK.

### LTS

 Laravel 5.1 is the first release of Laravel to receive **long term support**. Laravel 5.1 will receive bug fixes for 2 years and security fixes for 3 years. This support window is the largest ever provided for Laravel and provides stability and peace of mind for larger, enterprise clients and customers.

### PSR-2

The [PSR-2 coding style guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) has been adopted as the default style guide for the Laravel framework. Additionally, all generators have been updated to generate PSR-2 compatible syntax.

### Documentation

Every page of the Laravel documentation has been meticulously reviewed and dramatically improved. All code examples have also been reviewed and expanded to provide more relevance and context.

### Event Broadcasting

In many modern web applications, web sockets are used to implement real-time, live-updating user interfaces. When some data is updated on the server, a message is typically sent over a websocket connection to be handled by the client.

To assist you in building these types of applications, Laravel makes it easy to "broadcast" your events over a websocket connection. Broadcasting your Laravel events allows you to share the same event names between your server-side code and your client-side JavaScript framework.

To learn more about event broadcasting, check out the [event documentation](/{{version}}/events#broadcasting-events).

### Middleware Parameters

Middleware can now receive additional custom parameters. For example, if your application needs to verify that the authenticated user has a given "role" before performing a given action, you could create a `RoleMiddleware` that receives a role name as an additional argument:

	<?php

	namespace App\Http\Middleware;

	use Closure;

	class RoleMiddleware
	{
		/**
		 * Run the request filter.
		 *
		 * @param  \Illuminate\Http\Request  $request
		 * @param  \Closure  $next
		 * @param  string  $role
		 * @return mixed
		 */
		public function handle($request, Closure $next, $role)
		{
			if (! $request->user()->hasRole($role)) {
				// Redirect...
			}

			return $next($request);
		}

	}

Middleware parameters may be specified when defining the route by separating the middleware name and parameters with a `:`. Multiple parameters should be delimited by commas:

	Route::put('post/{id}', ['middleware' => 'role:editor', function ($id) {
		//
	}]);

For more information on middleware, check out the [middleware documentation](/{{version}}/middleware).

### Testing Overhaul

The built-in testing capabilities of Laravel have been dramatically improved. A variety of new methods provide a fluent, expressive interface for interacting with your application and examining its responses. For example, check out the following test:

    public function testNewUserRegistration()
    {
        $this->visit('/register')
             ->type('Taylor', 'name')
             ->check('terms')
             ->press('Register')
             ->seePageIs('/dashboard');
    }

For more information on testing, check out the [testing documentation](/{{version}}/testing).

### Model Factories

Laravel now ships with an easy way to create stub Eloquent models using [model factories](/{{version}}/testing#model-factories). Model factories allow you to easily define a set of "default" attributes for your Eloquent model, and then generate test model instances for your tests or database seeds. Model factories also take advantage of the powerful [Faker](https://github.com/fzaninotto/Faker) PHP library for generating random attribute data:

	$factory->define('App\User', function ($faker) {
	    return [
	        'name' => $faker->name,
	        'email' => $faker->email,
	        'password' => str_random(10),
	        'remember_token' => str_random(10),
	    ];
	});

For more information on model factories, check out [the documentation](/{{version}}/testing#model-factories).

### Artisan Improvements

Artisan commands may now be defined using a simple, route-like "signature", which provides an extremely simple interface for defining command line arguments and options. For example, you may define a simple command and its options like so:

    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'email:send {user} {--force}';

For more information on defining Artisan commands, consult the [Artisan documentation](/{{version}}/artisan).

### Folder Structure

To better express intent, the `app/Commands` directory has been renamed to `app/Jobs`. Additionally, the `app/Handlers` directory has been consolidated into a single `app/Listeners` directory which simply contains event listeners. However, this is not a breaking change and you are not required to update to the new folder structure to use Laravel 5.1.

### Encryption

In previous versions of Laravel, encryption was handled by the `mcrypt` PHP extension. However, beginning in Laravel 5.1, encryption is handled by the `openssl` extension, which is more actively maintained.

## Laravel 5.0

Laravel 5.0 introduces a fresh application structure to the default Laravel project. This new structure serves as a better foundation for building a robust application in Laravel, as well as embraces new auto-loading standards (PSR-4) throughout the application. First, let's examine some of the major changes:

### New Folder Structure

The old `app/models` directory has been entirely removed. Instead, all of your code lives directly within the `app` folder, and, by default, is organized to the `App` namespace. This default namespace can be quickly changed using the new `app:name` Artisan command.

Controllers, middleware, and requests (a new type of class in Laravel 5.0) are now grouped under the `app/Http` directory, as they are all classes related to the HTTP transport layer of your application. Instead of a single, flat file of route filters, all middleware are now broken into their own class files.

A new `app/Providers` directory replaces the `app/start` files from previous versions of Laravel 4.x. These service providers provide various bootstrapping functions to your application, such as error handling, logging, route loading, and more. Of course, you are free to create additional service providers for your application.

Application language files and views have been moved to the `resources` directory.

### Contracts

All major Laravel components implement interfaces which are located in the `illuminate/contracts` repository. This repository has no external dependencies. Having a convenient, centrally located set of interfaces you may use for decoupling and dependency injection will serve as an easy alternative option to Laravel Facades.

For more information on contracts, consult the [full documentation](/{{version}}/contracts).

### Route Cache

If your application is made up entirely of controller routes, you may utilize the new `route:cache` Artisan command to drastically speed up the registration of your routes. This is primarily useful on applications with 100+ routes and will **drastically** speed up this portion of your application.

### Route Middleware

In addition to Laravel 4 style route "filters", Laravel 5 now supports HTTP middleware, and the included authentication and CSRF "filters" have been converted to middleware. Middleware provides a single, consistent interface to replace all types of filters, allowing you to easily inspect, and even reject, requests before they enter your application.

For more information on middleware, check out [the documentation](/{{version}}/middleware).

### Controller Method Injection

In addition to the existing constructor injection, you may now type-hint dependencies on controller methods. The [service container](/{{version}}/container) will automatically inject the dependencies, even if the route contains other parameters:

	public function createPost(Request $request, PostRepository $posts)
	{
		//
	}

### Authentication Scaffolding

User registration, authentication, and password reset controllers are now included out of the box, as well as simple corresponding views, which are located at `resources/views/auth`. In addition, a "users" table migration has been included with the framework. Including these simple resources allows rapid development of application ideas without bogging down on authentication boilerplate. The authentication views may be accessed on the `auth/login` and `auth/register` routes. The `App\Services\Auth\Registrar` service is responsible for user validation and creation.

### Event Objects

You may now define events as objects instead of simply using strings. For example, check out the following event:

	<?php

	class PodcastWasPurchased
	{
		public $podcast;

		public function __construct(Podcast $podcast)
		{
			$this->podcast = $podcast;
		}
	}

The event may be dispatched like normal:

	Event::fire(new PodcastWasPurchased($podcast));

Of course, your event handler will receive the event object instead of a list of data:

	<?php

	class ReportPodcastPurchase
	{
		public function handle(PodcastWasPurchased $event)
		{
			//
		}
	}

For more information on working with events, check out the [full documentation](/{{version}}/events).

### Commands / Queueing

In addition to the queue job format supported in Laravel 4, Laravel 5 allows you to represent your queued jobs as simple command objects. These commands live in the `app/Commands` directory. Here's a sample command:

	<?php

	class PurchasePodcast extends Command implements SelfHandling, ShouldBeQueued
	{
		use SerializesModels;

		protected $user, $podcast;

		/**
		 * Create a new command instance.
		 *
		 * @return void
		 */
		public function __construct(User $user, Podcast $podcast)
		{
			$this->user = $user;
			$this->podcast = $podcast;
		}

		/**
		 * Execute the command.
		 *
		 * @return void
		 */
		public function handle()
		{
			// Handle the logic to purchase the podcast...

			event(new PodcastWasPurchased($this->user, $this->podcast));
		}
	}

The base Laravel controller utilizes the new `DispatchesCommands` trait, allowing you to easily dispatch your commands for execution:

	$this->dispatch(new PurchasePodcastCommand($user, $podcast));

Of course, you may also use commands for tasks that are executed synchronously (are not queued). In fact, using commands is a great way to encapsulate complex tasks your application needs to perform. For more information, check out the [command bus](/{{version}}/bus) documentation.

### Database Queue

A `database` queue driver is now included in Laravel, providing a simple, local queue driver that requires no extra package installation beyond your database software.

### Laravel Scheduler

In the past, developers have generated a Cron entry for each console command they wished to schedule. However, this is a headache. Your console schedule is no longer in source control, and you must SSH into your server to add the Cron entries. Let's make our lives easier. The Laravel command scheduler allows you to fluently and expressively define your command schedule within Laravel itself, and only a single Cron entry is needed on your server.

It looks like this:

	$schedule->command('artisan:command')->dailyAt('15:00');

Of course, check out the [full documentation](/{{version}}/scheduling) to learn all about the scheduler!

### Tinker / Psysh

The `php artisan tinker` command now utilizes [Psysh](https://github.com/bobthecow/psysh) by Justin Hileman, a more robust REPL for PHP. If you liked Boris in Laravel 4, you're going to love Psysh. Even better, it works on Windows! To get started, just try:

	php artisan tinker

### DotEnv

Instead of a variety of confusing, nested environment configuration directories, Laravel 5 now utilizes [DotEnv](https://github.com/vlucas/phpdotenv) by Vance Lucas. This library provides a super simple way to manage your environment configuration, and makes environment detection in Laravel 5 a breeze. For more details, check out the full [configuration documentation](/{{version}}/installation#environment-configuration).

### Laravel Elixir

Laravel Elixir, by Jeffrey Way, provides a fluent, expressive interface to compiling and concatenating your assets. If you've ever been intimidated by learning Grunt or Gulp, fear no more. Elixir makes it a cinch to get started using Gulp to compile your Less, Sass, and CoffeeScript. It can even run your tests for you!

For more information on Elixir, check out the [full documentation](/{{version}}/elixir).

### Laravel Socialite

Laravel Socialite is an optional, Laravel 5.0+ compatible package that provides totally painless authentication with OAuth providers. Currently, Socialite supports Facebook, Twitter, Google, and GitHub. Here's what it looks like:

	public function redirectForAuth()
	{
		return Socialize::with('twitter')->redirect();
	}

	public function getUserFromProvider()
	{
		$user = Socialize::with('twitter')->user();
	}

No more spending hours writing OAuth authentication flows. Get started in minutes! The [full documentation](/{{version}}/authentication#social-authentication) has all the details.

### Flysystem Integration

Laravel now includes the powerful [Flysystem](https://github.com/thephpleague/flysystem) filesystem abstraction library, providing pain free integration with local, Amazon S3, and Rackspace cloud storage - all with one, unified and elegant API! Storing a file in Amazon S3 is now as simple as:

	Storage::put('file.txt', 'contents');

For more information on the Laravel Flysystem integration, consult the [full documentation](/{{version}}/filesystem).

### Form Requests

Laravel 5.0 introduces **form requests**, which extend the `Illuminate\Foundation\Http\FormRequest` class. These request objects can be combined with controller method injection to provide a boiler-plate free method of validating user input. Let's dig in and look at a sample `FormRequest`:

	<?php

	namespace App\Http\Requests;

	class RegisterRequest extends FormRequest
	{
		public function rules()
		{
			return [
				'email' => 'required|email|unique:users',
				'password' => 'required|confirmed|min:8',
			];
		}

		public function authorize()
		{
			return true;
		}
	}

Once the class has been defined, we can type-hint it on our controller action:

	public function register(RegisterRequest $request)
	{
		var_dump($request->input());
	}

When the Laravel service container identifies that the class it is injecting is a `FormRequest` instance, the request will **automatically be validated**. This means that if your controller action is called, you can safely assume the HTTP request input has been validated according to the rules you specified in your form request class. Even more, if the request is invalid, an HTTP redirect, which you may customize, will automatically be issued, and the error messages will be either flashed to the session or converted to JSON. **Form validation has never been more simple.** For more information on `FormRequest` validation, check out the [documentation](/{{version}}/validation#form-request-validation).

### Simple Controller Request Validation

The Laravel 5 base controller now includes a `ValidatesRequests` trait. This trait provides a simple `validate` method to validate incoming requests. If `FormRequests` are a little too much for your application, check this out:

	public function createPost(Request $request)
	{
		$this->validate($request, [
			'title' => 'required|max:255',
			'body' => 'required',
		]);
	}

If the validation fails, an exception will be thrown and the proper HTTP response will automatically be sent back to the browser. The validation errors will even be flashed to the session! If the request was an AJAX request, Laravel even takes care of sending a JSON representation of the validation errors back to you.

For more information on this new method, check out [the documentation](/{{version}}/validation#validation-quickstart).

### New Generators

To complement the new default application structure, new Artisan generator commands have been added to the framework. See `php artisan list` for more details.

### Configuration Cache

You may now cache all of your configuration in a single file using the `config:cache` command.

### Symfony VarDumper

The popular `dd` helper function, which dumps variable debug information, has been upgraded to use the amazing Symfony VarDumper. This provides color-coded output and even collapsing of arrays. Just try the following in your project:

	dd([1, 2, 3]);

## Laravel 4.2

The full change list for this release by running the `php artisan changes` command from a 4.2 installation, or by [viewing the change file on Github](https://github.com/laravel/framework/blob/4.2/src/Illuminate/Foundation/changes.json). These notes only cover the major enhancements and changes for the release.

> **Note:** During the 4.2 release cycle, many small bug fixes and enhancements were incorporated into the various Laravel 4.1 point releases. So, be sure to check the change list for Laravel 4.1 as well!

### PHP 5.4 Requirement

Laravel 4.2 requires PHP 5.4 or greater. This upgraded PHP requirement allows us to use new PHP features such as traits to provide more expressive interfaces for tools like [Laravel Cashier](/docs/billing). PHP 5.4 also brings significant speed and performance improvements over PHP 5.3.

### Laravel Forge

Laravel Forge, a new web based application, provides a simple way to create and manage PHP servers on the cloud of your choice, including Linode, DigitalOcean, Rackspace, and Amazon EC2. Supporting automated Nginx configuration, SSH key access, Cron job automation, server monitoring via NewRelic & Papertrail, "Push To Deploy", Laravel queue worker configuration, and more, Forge provides the simplest and most affordable way to launch all of your Laravel applications.

The default Laravel 4.2 installation's `app/config/database.php` configuration file is now configured for Forge usage by default, allowing for more convenient deployment of fresh applications onto the platform.

More information about Laravel Forge can be found on the [official Forge website](https://forge.laravel.com).

### Laravel Homestead

Laravel Homestead is an official Vagrant environment for developing robust Laravel and PHP applications. The vast majority of the boxes' provisioning needs are handled before the box is packaged for distribution, allowing the box to boot extremely quickly. Homestead includes Nginx 1.6, PHP 5.6, MySQL, Postgres, Redis, Memcached, Beanstalk, Node, Gulp, Grunt, & Bower. Homestead includes a simple `Homestead.yaml` configuration file for managing multiple Laravel applications on a single box.

The default Laravel 4.2 installation now includes an `app/config/local/database.php` configuration file that is configured to use the Homestead database out of the box, making Laravel initial installation and configuration more convenient.

The official documentation has also been updated to include [Homestead documentation](/docs/homestead).

### Laravel Cashier

Laravel Cashier is a simple, expressive library for managing subscription billing with Stripe. With the introduction of Laravel 4.2, we are including Cashier documentation along with the main Laravel documentation, though installation of the component itself is still optional. This release of Cashier brings numerous bug fixes, multi-currency support, and compatibility with the latest Stripe API.

### Daemon Queue Workers

The Artisan `queue:work` command now supports a `--daemon` option to start a worker in "daemon mode", meaning the worker will continue to process jobs without ever re-booting the framework. This results in a significant reduction in CPU usage at the cost of a slightly more complex application deployment process.

More information about daemon queue workers can be found in the [queue documentation](/docs/queues#daemon-queue-worker).

### Mail API Drivers

Laravel 4.2 introduces new Mailgun and Mandrill API drivers for the `Mail` functions. For many applications, this provides a faster and more reliable method of sending e-mails than the SMTP options. The new drivers utilize the Guzzle 4 HTTP library.

### Soft Deleting Traits

A much cleaner architecture for "soft deletes" and other "global scopes" has been introduced via PHP 5.4 traits. This new architecture allows for the easier construction of similar global traits, and a cleaner separation of concerns within the framework itself.

More information on the new `SoftDeletingTrait` may be found in the [Eloquent documentation](/docs/eloquent#soft-deleting).

### Convenient Auth & Remindable Traits

The default Laravel 4.2 installation now uses simple traits for including the needed properties for the authentication and password reminder user interfaces. This provides a much cleaner default `User` model file out of the box.

### "Simple Paginate"

A new `simplePaginate` method was added to the query and Eloquent builder which allows for more efficient queries when using simple "Next" and "Previous" links in your pagination view.

### Migration Confirmation

In production, destructive migration operations will now ask for confirmation. Commands may be forced to run without any prompts using the `--force` command.

## Laravel 4.1

### Full Change List

The full change list for this release by running the `php artisan changes` command from a 4.1 installation, or by [viewing the change file on Github](https://github.com/laravel/framework/blob/4.1/src/Illuminate/Foundation/changes.json). These notes only cover the major enhancements and changes for the release.

### New SSH Component

An entirely new `SSH` component has been introduced with this release. This feature allows you to easily SSH into remote servers and run commands. To learn more, consult the [SSH component documentation](/docs/ssh).

The new `php artisan tail` command utilizes the new SSH component. For more information, consult the `tail` [command documentation](http://laravel.com/docs/ssh#tailing-remote-logs).

### Boris In Tinker

The `php artisan tinker` command now utilizes the [Boris REPL](https://github.com/d11wtq/boris) if your system supports it. The `readline` and `pcntl` PHP extensions must be installed to use this feature. If you do not have these extensions, the shell from 4.0 will be used.

### Eloquent Improvements

A new `hasManyThrough` relationship has been added to Eloquent. To learn how to use it, consult the [Eloquent documentation](/docs/eloquent#has-many-through).

A new `whereHas` method has also been introduced to allow [retrieving models based on relationship constraints](/docs/eloquent#querying-relations).

### Database Read / Write Connections

Automatic handling of separate read / write connections is now available throughout the database layer, including the query builder and Eloquent. For more information, consult [the documentation](/docs/database#read-write-connections).

### Queue Priority

Queue priorities are now supported by passing a comma-delimited list to the `queue:listen` command.

### Failed Queue Job Handling

The queue facilities now include automatic handling of failed jobs when using the new `--tries` switch on `queue:listen`. More information on handling failed jobs can be found in the [queue documentation](/docs/queues#failed-jobs).

### Cache Tags

Cache "sections" have been superseded by "tags". Cache tags allow you to assign multiple "tags" to a cache item, and flush all items assigned to a single tag. More information on using cache tags may be found in the [cache documentation](/docs/cache#cache-tags).

### Flexible Password Reminders

The password reminder engine has been changed to provide greater developer flexibility when validating passwords, flashing status messages to the session, etc. For more information on using the enhanced password reminder engine, [consult the documentation](/docs/security#password-reminders-and-reset).

### Improved Routing Engine

Laravel 4.1 features a totally re-written routing layer. The API is the same; however, registering routes is a full 100% faster compared to 4.0. The entire engine has been greatly simplified, and the dependency on Symfony Routing has been minimized to the compiling of route expressions.

### Improved Session Engine

With this release, we're also introducing an entirely new session engine. Similar to the routing improvements, the new session layer is leaner and faster. We are no longer using Symfony's (and therefore PHP's) session handling facilities, and are using a custom solution that is simpler and easier to maintain.

### Doctrine DBAL

If you are using the `renameColumn` function in your migrations, you will need to add the `doctrine/dbal` dependency to your `composer.json` file. This package is no longer included in Laravel by default.


text:
A talk about Rust. You can view it
[here](http://steveklabnik.github.io/hello_rust). Use the left and right keys
to navigate.

`index.md` contains the example slides in Markdown format. To build, just run
`make`.


text:
import java.util.regex.Pattern;
import java.util.Random;

/** Utility function for Strings for hw6.
 *  @author Josh Hug
 */
public class StringUtils {
    /** To get the style checker to be quiet. */
    private static final int ALPHABET_SIZE = 26;

    /** Random number generator for this class. */
    private static Random r = new Random();

    /** Sets random seed to L so that results of randomString are predictable.*/
    public static void setSeed(long l) {
        r = new Random(l);
    }

    /** Returns the next random string of length LENGTH. */
    public static String randomString(int length) {
        char[] someChars = new char[length];
        for (int i = 0; i < length; i++) {
            someChars[i] = (char) (r.nextInt(ALPHABET_SIZE) + 'a');
        }
        return new String(someChars);
    }

    /** Returns true if string S consists of characters between
      * 'a' and 'z' only. No spaces, numbers, upper-case, or any other
      * characters are allowed.
      */
    public static boolean isLowerCase(String s) {
        return Pattern.matches("[a-z]*", s);
    }

    /** Returns the string that comes right after S in alphabetical order.
      * For example, if s is 'potato', this method will return 'potatp'. If
      * the last character is a z, then we add to the next position, and so
      * on.
      */
    public static String nextString(String s) {
        /* Handle all zs as a special case to keep helper method simple. */
        if (isAllzs(s)) {
            return allAs(s.length() + 1);
        }
        char[] charVersion = s.toCharArray();
        incrementCharArray(charVersion, charVersion.length - 1);
        return new String(charVersion);
    }

    /** Helper function for nextString. Increments the Pth position of X
      * by one, wrapping around to 'a' if p == 'z'. If wraparound occurs,
      * then we need to carry the one, and we increment position P - 1.
      *
      * Will fail for a character array containing only zs.
      */
    private static void incrementCharArray(char [] x, int p) {
        if (x[p] != 'z') {
            x[p] += 1;
        } else {
            x[p] = 'a';
            incrementCharArray(x, p - 1);
        }
    }

    /** Returns a string of all 'a' of length LEN. */
    private static String allAs(int len) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < len; i++) {
            sb.append('a');
        }
        return sb.toString();
    }

    /** Returns true if S is all 'z'. False for empty strings */
    public static boolean isAllzs(String s) {
        return Pattern.matches("[z]+", s);
    }

}


text:
var pgRestify = require('../lib/index');
var should = require('should');
var async = require('async');

describe('hooks', function() {

  it('should validate the event argument', function(done){

    var hooks = new pgRestify.Hooks();

    // validate that the right event names work

    hooks.events.forEach(function(event) {

      hooks.addPreHookForAllResources(event, function(){});
      hooks.addPostHookForAllResources(event, function(){});

      hooks.addPreHookForResource(event, 'resource', function(){});
      hooks.addPostHookForResource(event, 'resource', function(){});

    });

    // validate that bad values throw an error

    (function() {
      hooks.addPreHookForAllResources('bad', function(){});
    }).should.throw('invalid event value "bad"');

    (function() {
      hooks.addPostHookForAllResources('bad', function(){});
    }).should.throw('invalid event value "bad"');

    (function() {
      hooks.addPreHookForResource('bad', 'resource', function(){});
    }).should.throw('invalid event value "bad"');

    (function() {
      hooks.addPostHookForResource('bad', 'resource', function(){});
    }).should.throw('invalid event value "bad"');

    done();

  });

  it('should run hooks for all resources', function(done){

    var hooks = new pgRestify.Hooks();

    hooks.addPreHookForAllResources('get', function preHook1(req, res, dbClient, next) {
      req.preHook1 = true;
      dbClient.value = 1;
      next(null);
    });
    hooks.addPreHookForAllResources('get', function preHook2(req, res, dbClient, next) {
      res.preHook2 = true;
      dbClient.value = 2;
      next(null);
    });
    hooks.addPreHookForAllResources('post', function notRunPreHook(req, res, dbClient, next) {
      res.preHook2 = false;
      dbClient.value = 2;
      next(null);
    });

    hooks.addPostHookForAllResources('get', function postHook1(req, res, dbClient, next) {
      req.postHook1 = 'test';
      res.postHook2 = 12;
      next(null);
    });
    hooks.addPostHookForAllResources('get', function postHook2(req, res, dbClient, next) {
      res.postHook2 = 123;
      dbClient.value = 3;
      next(null);
    });
    hooks.addPostHookForAllResources('put', function notRunPostHook(req, res, dbClient, next) {
      res.postHook2 = 1234;
      dbClient.value = 3;
      next(null);
    });

    var req = {};
    var res = {};
    var dbClient = {};

    async.series([

      function(next) {
        hooks.runPreHooks('get', '', req, res, dbClient, function(err) {

          req.preHook1.should.eql(true);
          res.preHook2.should.eql(true);
          (typeof req.postHook1).should.eql('undefined');
          (typeof res.postHook2).should.eql('undefined');
          dbClient.value.should.eql(2);

          next();

        });
      },

      function(next) {
        hooks.runPostHooks('get', '', req, res, dbClient, function(err) {

          req.preHook1.should.eql(true);
          res.preHook2.should.eql(true);
          req.postHook1.should.eql('test');
          res.postHook2.should.eql(123);
          dbClient.value.should.eql(3);

          next();

        });
      },

    ], done);

  });

  it('should run hooks for a specific resource', function(done){

    var hooks = new pgRestify.Hooks();

    hooks.addPreHookForResource('get', 'foos', function preHook1(req, res, dbClient, next) {
      req.preHook1 = true;
      dbClient.value = 1;
      next(null);
    });
    hooks.addPreHookForResource('get', 'foos', function preHook2(req, res, dbClient, next) {
      res.preHook2 = true;
      dbClient.value = 2;
      next(null);
    });
    hooks.addPreHookForResource('get', 'bars', function notRunPreHook(req, res, dbClient, next) {
      res.preHook2 = false;
      dbClient.value = 3;
      next(null);
    });

    hooks.addPostHookForResource('get', 'foos', function postHook1(req, res, dbClient, next) {
      req.postHook1 = true;
      dbClient.value++; // 3
      next(null);
    });
    hooks.addPostHookForResource('get', 'foos', function postHook2(req, res, dbClient, next) {
      res.postHook2 = true;
      dbClient.value = dbClient.value + 2; // 5
      next(null);
    });
    hooks.addPostHookForResource('get', 'bars', function notRunPreHook(req, res, dbClient, next) {
      res.preHook2 = false;
      dbClient.value = dbClient.value++; // 6
      next(null);
    });

    var req = {};
    var res = {};
    var dbClient = {};

    async.series([

      function(next) {
        hooks.runPreHooks('get', 'foos', req, res, dbClient, function(err) {

          req.preHook1.should.eql(true);
          res.preHook2.should.eql(true);
          (typeof req.postHook1).should.eql('undefined');
          (typeof res.postHook2).should.eql('undefined');
          dbClient.value.should.eql(2);

          next();

        });
      },

      function(next) {
        hooks.runPostHooks('get', 'foos', req, res, dbClient, function(err) {

          req.preHook1.should.eql(true);
          res.preHook2.should.eql(true);
          req.postHook1.should.eql(true);
          res.postHook2.should.eql(true);
          dbClient.value.should.eql(5);

          next();

        });
      },

    ], done);

  });

  it('should run hooks for all and specific resource', function(done) {

    var hooks = new pgRestify.Hooks();

    hooks.addPreHookForAllResources('get', function preHook1(req, res, dbClient, next) {
      req.preHook1 = true;
      dbClient.value = 1;
      next(null);
    });
    hooks.addPreHookForResource('get', 'foos', function preHook2(req, res, dbClient, next) {
      res.preHook2 = true;
      dbClient.value = 2;
      next(null);
    });
    hooks.addPreHookForResource('get', 'bars', function notRunPreHook(req, res, dbClient, next) {
      res.preHook2 = false;
      dbClient.value = 3;
      next(null);
    });

    //the all resources should be run first even if defined second
    hooks.addPostHookForResource('get', 'foos', function postHook2(req, res, dbClient, next) {
      res.postHook2 = true;
      req.postHook1.should.eql(true);
      dbClient.value.should.eql(3);//this value should already be set by postHook1
      dbClient.value++;//4
      next(null);
    });
    hooks.addPostHookForAllResources('get', function postHook1(req, res, dbClient, next) {
      req.postHook1 = true;
      dbClient.value++;//3
      next(null);
    });
    hooks.addPostHookForResource('get', 'bars', function notRunPostHook(req, res, dbClient, next) {
      res.postHook2 = false;
      dbClient.value = 1;
      next(null);
    });

    var req = {};
    var res = {};
    var dbClient = {};

    async.series([

      function(next) {
        hooks.runPreHooks('get', 'foos', req, res, dbClient, function(err) {

          req.preHook1.should.eql(true);
          res.preHook2.should.eql(true);
          (typeof req.postHook1).should.eql('undefined');
          (typeof res.postHook2).should.eql('undefined');
          dbClient.value.should.eql(2);

          next();

        });
      },

      function(next) {
        hooks.runPostHooks('get', 'foos', req, res, dbClient, function(err) {

          req.preHook1.should.eql(true);
          res.preHook2.should.eql(true);
          req.postHook1.should.eql(true);
          res.postHook2.should.eql(true);
          dbClient.value.should.eql(4);

          next();

        });
      },

    ], done);

  });

  it('should run pre hooks until an error', function(done) {

    var hooks = new pgRestify.Hooks();

    hooks.addPreHookForAllResources('get', function preHook1(req, res, dbClient, next) {
      req.preHook1 = true;
      dbClient.value = 1;
      next(null);
    });
    hooks.addPreHookForAllResources('get', function preHook2(req, res, dbClient, next) {
      res.preHook2 = true;
      dbClient.value = 2;
      next(new Error('pre hook error'));
    });
    // this third hook isn't run because an error occurs
    hooks.addPreHookForAllResources('get', function notRunPreHook(req, res, dbClient, next) {
      res.preHook2 = false;
      dbClient.value = 0;
      next(null);
    });

    hooks.addPostHookForAllResources('get', function postHook1(req, res, dbClient, next) {
      req.postHook1 = 'test';
      res.postHook2 = 12;
      next(null);
    });
    hooks.addPostHookForAllResources('get', function postHook2(req, res, dbClient, next) {
      res.postHook2 = 123;
      dbClient.value = 3;
      next(new Error('post hook error'));
    });
    // this third hook isn't run because an error occurs
    hooks.addPostHookForAllResources('get', function notRunPostHook(req, res, dbClient, next) {
      res.postHook2 = false;
      dbClient.value = 0;
      next(null);
    });

    var req = {};
    var res = {};
    var dbClient = {};

    async.series([

      function(next) {
        hooks.runPreHooks('get', '', req, res, dbClient, function(err) {

          err.message.should.eql('pre hook error');

          req.preHook1.should.eql(true);
          res.preHook2.should.eql(true);
          (typeof req.postHook1).should.eql('undefined');
          (typeof res.postHook2).should.eql('undefined');
          dbClient.value.should.eql(2);

          next();

        });
      },

      function(next) {
        hooks.runPostHooks('get', '', req, res, dbClient, function(err) {

          err.message.should.eql('post hook error');

          req.preHook1.should.eql(true);
          res.preHook2.should.eql(true);
          req.postHook1.should.eql('test');
          res.postHook2.should.eql(123);
          dbClient.value.should.eql(3);

          next();

        });
      },

    ], done);

  });

});


text:
package server

import (
	"compress/gzip"
	"io"
	"net"
	"net/http"
	"os"
	"strings"
	"sync"

	"github.com/cockroachdb/cockroach/client"
	"github.com/cockroachdb/cockroach/gossip"
	"github.com/cockroachdb/cockroach/kv"
	"github.com/cockroachdb/cockroach/multiraft"
	"github.com/cockroachdb/cockroach/resource"
	"github.com/cockroachdb/cockroach/rpc"
	"github.com/cockroachdb/cockroach/storage"
	"github.com/cockroachdb/cockroach/structured"
	"github.com/cockroachdb/cockroach/util"
	"github.com/cockroachdb/cockroach/util/hlc"
	"github.com/cockroachdb/cockroach/util/log"
	assetfs "github.com/elazarl/go-bindata-assetfs"
)

// Allocation pool for gzip writers.
var gzipWriterPool sync.Pool

// Server is the cockroach server node.
type Server struct {
	ctx *Context

	host           string
	mux            *http.ServeMux
	clock          *hlc.Clock
	rpc            *rpc.Server
	gossip         *gossip.Gossip
	kv             *client.KV
	kvDB           *kv.DBServer
	kvREST         *kv.RESTServer
	node           *Node
	admin          *adminServer
	status         *statusServer
	structuredDB   structured.DB
	structuredREST *structured.RESTServer
	httpListener   *net.Listener // holds http endpoint information
	raftTransport  multiraft.Transport
}

// NewServer creates a Server from a server.Context.
func NewServer(ctx *Context) (*Server, error) {
	if ctx == nil {
		return nil, util.Error("ctx must not be null")
	}
	// Determine hostname in case it hasn't been specified in -rpc or -http.
	host, err := os.Hostname()
	if err != nil {
		host = "127.0.0.1"
	}

	rpcAddr := ctx.RPC
	// If the specified rpc address includes no host component, use the hostname.
	if strings.HasPrefix(rpcAddr, ":") {
		rpcAddr = host + rpcAddr
	}
	_, err = net.ResolveTCPAddr("tcp", rpcAddr)
	if err != nil {
		return nil, util.Errorf("unable to resolve RPC address %q: %v", rpcAddr, err)
	}

	var tlsConfig *rpc.TLSConfig
	if ctx.Certs == "" {
		tlsConfig = rpc.LoadInsecureTLSConfig()
	} else {
		if tlsConfig, err = rpc.LoadTLSConfigFromDir(ctx.Certs); err != nil {
			return nil, util.Errorf("unable to load TLS config: %v", err)
		}
	}

	s := &Server{
		ctx:   ctx,
		host:  host,
		mux:   http.NewServeMux(),
		clock: hlc.NewClock(hlc.UnixNano),
	}
	s.clock.SetMaxOffset(ctx.MaxOffset)

	rpcContext := rpc.NewContext(s.clock, tlsConfig)
	go rpcContext.RemoteClocks.MonitorRemoteOffsets()

	s.rpc = rpc.NewServer(util.MakeRawAddr("tcp", rpcAddr), rpcContext)
	s.gossip = gossip.New(rpcContext, s.ctx.GossipInterval, s.ctx.GossipBootstrap)

	// Create a client.KVSender instance for use with this node's
	// client to the key value database as well as
	ds := kv.NewDistSender(s.clock, s.gossip)
	sender := kv.NewTxnCoordSender(ds, s.clock, ctx.Linearizable)
	s.kv = client.NewKV(nil, sender)
	s.kv.User = storage.UserRoot

	s.raftTransport, err = newRPCTransport(s.gossip, s.rpc, rpcContext)
	if err != nil {
		return nil, err
	}

	s.kvDB = kv.NewDBServer(sender)
	s.kvREST = kv.NewRESTServer(s.kv)
	// TODO(bdarnell): make StoreConfig configurable.
	s.node = NewNode(s.kv, s.gossip, storage.StoreConfig{}, s.raftTransport)
	s.admin = newAdminServer(s.kv)
	s.status = newStatusServer(s.kv, s.gossip)
	s.structuredDB = structured.NewDB(s.kv)
	s.structuredREST = structured.NewRESTServer(s.structuredDB)

	return s, nil
}

// Start runs the RPC and HTTP servers, starts the gossip instance (if
// selfBootstrap is true, uses the rpc server's address as the gossip
// bootstrap), and starts the node using the supplied engines slice.
func (s *Server) Start(selfBootstrap bool) error {
	// Bind RPC socket and launch goroutine.
	if err := s.rpc.Start(); err != nil {
		return err
	}
	log.Infof("Started RPC server at %s", s.rpc.Addr())

	// Handle self-bootstrapping case for a single node.
	if selfBootstrap {
		s.gossip.SetBootstrap([]net.Addr{s.rpc.Addr()})
	}
	s.gossip.Start(s.rpc)
	log.Infoln("Started gossip instance")

	if err := s.node.start(s.rpc, s.clock, s.ctx.Engines, s.ctx.NodeAttributes); err != nil {
		return err
	}

	// TODO(spencer): add tls to the HTTP server.
	s.initHTTP()
	httpAddr := s.ctx.HTTP
	ln, err := net.Listen("tcp", httpAddr)
	if err != nil {
		return util.Errorf("could not listen on %s: %s", httpAddr, err)
	}
	// Obtaining the http end point listener is difficult using
	// http.ListenAndServe(), so we are storing it with the server.
	s.httpListener = &ln
	log.Infof("Starting HTTP server at %s", ln.Addr())
	go http.Serve(ln, s)
	return nil
}

func (s *Server) initHTTP() {
	s.mux.Handle("/", http.FileServer(
		&assetfs.AssetFS{Asset: resource.Asset, AssetDir: resource.AssetDir, Prefix: "./ui/"}))

	// Admin handlers.
	s.admin.registerHandlers(s.mux)

	// Status endpoints:
	s.status.registerHandlers(s.mux)

	s.mux.Handle(kv.RESTPrefix, s.kvREST)
	s.mux.Handle(kv.DBPrefix, s.kvDB)
	s.mux.Handle(structured.StructuredKeyPrefix, s.structuredREST)
}

// Stop stops the server.
func (s *Server) Stop() {
	s.node.stop()
	s.gossip.Stop()
	s.rpc.Close()
	s.kv.Close()
	s.raftTransport.Close()
}

type gzipResponseWriter struct {
	io.WriteCloser
	http.ResponseWriter
}

func newGzipResponseWriter(w http.ResponseWriter) *gzipResponseWriter {
	var gz *gzip.Writer
	if gzI := gzipWriterPool.Get(); gzI == nil {
		gz = gzip.NewWriter(w)
	} else {
		gz = gzI.(*gzip.Writer)
		gz.Reset(w)
	}
	return &gzipResponseWriter{WriteCloser: gz, ResponseWriter: w}
}

func (w *gzipResponseWriter) Write(b []byte) (int, error) {
	return w.WriteCloser.Write(b)
}

func (w *gzipResponseWriter) Close() {
	if w.WriteCloser != nil {
		w.WriteCloser.Close()
		gzipWriterPool.Put(w.WriteCloser)
		w.WriteCloser = nil
	}
}

// ServeHTTP is necessary to implement the http.Handler interface. It
// will gzip a response if the appropriate request headers are set.
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	if !strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") {
		s.mux.ServeHTTP(w, r)
		return
	}
	w.Header().Set("Content-Encoding", "gzip")
	gzw := newGzipResponseWriter(w)
	defer gzw.Close()
	s.mux.ServeHTTP(gzw, r)
}