You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jf...@apache.org on 2014/03/05 06:40:02 UTC

svn commit: r1574384 [2/5] - in /thrift/site: ./ content/ content/tutorial/ layouts/ lib/ publish/ publish/about/ publish/developers/ publish/docs/ publish/docs/BuildingFromSource/ publish/docs/HowToContribute/ publish/docs/committers/ publish/docs/com...

Modified: thrift/site/publish/docs/types/index.html
URL: http://svn.apache.org/viewvc/thrift/site/publish/docs/types/index.html?rev=1574384&r1=1574383&r2=1574384&view=diff
==============================================================================
--- thrift/site/publish/docs/types/index.html (original)
+++ thrift/site/publish/docs/types/index.html Wed Mar  5 05:40:00 2014
@@ -82,7 +82,9 @@
 <li>i64: A 64-bit signed integer</li>
 <li>double: A 64-bit floating point number</li>
 <li>string: A text string encoded using UTF-8 encoding</li>
-</ul><p>Note the absence of unsigned integer types. This is due to the fact that there are no native unsigned integer types in many programming languages.</p>
+</ul>
+
+<p>Note the absence of unsigned integer types. This is due to the fact that there are no native unsigned integer types in many programming languages.</p>
 
 <h3>Special Types</h3>
 
@@ -120,6 +122,7 @@ While defaults are provided, the type ma
 <p>A service consists of a set of named functions, each with a list of parameters and a return type.</p>
 
 <p>Note that void is a valid type for a function return, in addition to all other defined Thrift types. Additionally, an async modifier keyword may be added to a void function, which will generate code that does not wait for a response. Note that a pure void function will return a response to the client which guarantees that the operation has completed on the server side. With async method calls the client will only be guaranteed that the request succeeded at the transport layer. Async method calls of the same client may be executed in parallel/out of order by the server.</p>
+
 	</div>
 	<div class="container">
 	<hr>

Modified: thrift/site/publish/download/index.html
URL: http://svn.apache.org/viewvc/thrift/site/publish/download/index.html?rev=1574384&r1=1574383&r2=1574384&view=diff
==============================================================================
--- thrift/site/publish/download/index.html (original)
+++ thrift/site/publish/download/index.html Wed Mar  5 05:40:00 2014
@@ -76,7 +76,9 @@
 [<a href="https://dist.apache.org/repos/dist/release/thrift/0.9.1/thrift-0.9.1.tar.gz.md5">MD5</a>]</li>
 <li>
 <a href="http://www.apache.org/dyn/closer.cgi?path=/thrift/0.9.1/thrift-0.9.1.exe">Thrift compiler for Windows (thrift-0.9.1.exe)</a> [<a href="https://dist.apache.org/repos/dist/release/thrift/0.9.1/thrift-0.9.1.exe.asc">PGP</a>] [<a href="https://dist.apache.org/repos/dist/release/thrift/0.9.1/thrift-0.9.1.exe.md5">MD5</a>]</li>
-</ul><h2>Maven artifact</h2>
+</ul>
+
+<h2>Maven artifact</h2>
 
 <pre><code>
 &lt;dependency&gt;
@@ -88,19 +90,24 @@
 
 <p>When downloading from a mirror, please be sure to <a href="http://www.apache.org/info/verification.html">verify</a> the checksums and signature (see the MD5 and PGP links above). The <a href="https://dist.apache.org/repos/dist/release/thrift/KEYS">KEYS</a> file contains the public key(s) used for signing releases.</p>
 
-<hr><h2>Incubator Releases</h2>
+<hr>
+
+<h2>Incubator Releases</h2>
 
 <p>Releases from the incubator ( less than 0.6.0 ) are available at the <a href="http://archive.apache.org/dist/incubator/thrift/">Thrift Incubator Archive</a></p>
 
 <p>Releases from 0.6.0 up to the current release are available at the <a href="http://archive.apache.org/dist/thrift/">Apache Thrift Archive</a></p>
 
-<hr><h2>GIT Checkout</h2>
+<hr>
+
+<h2>GIT Checkout</h2>
 
 <p>For those who would like to participate in Thrift development, you may checkout Thrift from the <a href="https://git-wip-us.apache.org/repos/asf?p=thrift.git">Apache GIT repository</a>.
 </p><pre><code>
 git clone https://git-wip-us.apache.org/repos/asf/thrift.git thrift
 cd thrift
 </code></pre>
+
 	</div>
 	<div class="container">
 	<hr>

Modified: thrift/site/publish/index.html
URL: http://svn.apache.org/viewvc/thrift/site/publish/index.html?rev=1574384&r1=1574383&r2=1574384&view=diff
==============================================================================
--- thrift/site/publish/index.html (original)
+++ thrift/site/publish/index.html Wed Mar  5 05:40:00 2014
@@ -71,12 +71,12 @@
     <p>
       The Apache Thrift software framework, for scalable cross-language services development, combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, OCaml and Delphi and other languages.
     </p>
-    
+
     <h3>Getting Started</h3>
     <p>
       </p>
 <ul>
-<li>
+        <li>
           <b>Download Apache Thrift</b>
           <p>To get started, <a href="/download/">download</a> a copy of Thrift.</p>
         </li>
@@ -96,7 +96,9 @@
           <p>The sample tutorial.thrift file used for all the client and server tutorials can be found <a href="https://git-wip-us.apache.org/repos/asf/thrift/?p=thrift.git;a=tree;f=tutorial">here</a>. </p>
         </li>
       </ul>
-<br><p>
+    
+    <br>
+    <p>
       To learn more about Apache Thrift <a href="/static/files/thrift-20070401.pdf">Read the Whitepaper</a>
     </p>
   </div>
@@ -124,85 +126,84 @@
   </div>
 </div>
 
-<hr><p></p><h3>Example<h3>
+<hr>
+
+<p></p><h3>Example<h3>
 </h3>
 </h3><p>Apache Thrift allows you to define data types and service interfaces in a simple definition file. Taking that file as input, the compiler generates code to be used to easily build RPC clients and servers that communicate seamlessly across programming languages. Instead of writing a load of boilerplate code to serialize and transport your objects and invoke remote methods, you can get right down to business.
 </p>
 <p>The following example is a simple service to store user objects for a web front end.</p>
 <div class="tabbable">
   <ul class="nav nav-tabs">
-<li class="active"><a href="#1" data-toggle="tab">Thrift Definition File</a></li>
+    <li class="active"><a href="#1" data-toggle="tab">Thrift Definition File</a></li>
     <li><a href="#2" data-toggle="tab">Python Client</a></li>
-    <li><a href="#3" data-toggle="tab">C++ Server</a></li>
+    <li><a href="#3" data-toggle="tab">Java Server</a></li>
   </ul>
-<div class="tab-content">
+  <div class="tab-content">
     <div class="tab-pane active" id="1">
-      <pre><code>
-struct UserProfile {
-  1: i32 uid,
-  2: string name,
-  3: string blurb
-}
-service UserStorage {
-  void store(1: UserProfile user),
-  UserProfile retrieve(1: i32 uid)
-}
-      </code></pre>
+<pre><code class="language-text">service Calculator extends shared.SharedService {
+
+  /**
+   * A method definition looks like C code. It has a return type, arguments,
+   * and optionally a list of exceptions that it may throw. Note that argument
+   * lists and exception lists are specified using the exact same syntax as
+   * field lists in struct or exception definitions.
+   */
+
+   void ping(),
+
+   i32 add(1:i32 num1, 2:i32 num2),
+
+   i32 calculate(1:i32 logid, 2:Work w) throws (1:InvalidOperation ouch),
+
+   /**
+    * This method has a oneway modifier. That means the client only makes
+    * a request and does not listen for any response at all. Oneway methods
+    * must be void.
+    */
+   oneway void zip()
+
+}</code></pre>
     </div>
     <div class="tab-pane" id="2">
-      <div class="CodeRay"><div class="code"><pre><code class="language-python">Make an <span style="color:#369;font-weight:bold">object</span>
-
-up = UserProfile(uid=<span style="color:#00D">1</span>,
-                 name=<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Test User</span><span style="color:#710">"</span></span>,
-                 blurb=<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Thrift is great</span><span style="color:#710">"</span></span>)
+<pre><code class="language-python">  <span style="color:#777"># Make socket</span>
+  transport = TSocket.TSocket(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">'</span><span style="color:#D20">localhost</span><span style="color:#710">'</span></span>, <span style="color:#00D">9090</span>)
 
-Talk to a server via TCP sockets, using a binary protocol
+  <span style="color:#777"># Buffering is critical. Raw sockets are very slow</span>
+  transport = TTransport.TBufferedTransport(transport)
 
-transport = TSocket.TSocket(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">localhost</span><span style="color:#710">"</span></span>, <span style="color:#00D">9090</span>)
-transport.open()
-protocol = TBinaryProtocol.TBinaryProtocol(transport)
+  <span style="color:#777"># Wrap in a protocol</span>
+  protocol = TBinaryProtocol.TBinaryProtocol(transport)
 
-Use the service we already defined
+  <span style="color:#777"># Create a client to use the protocol encoder</span>
+  client = Calculator.Client(protocol)
 
-service = UserStorage.Client(protocol)
-service.store(up)
+  <span style="color:#777"># Connect!</span>
+  transport.open()
 
-Retrieve something <span style="color:#080;font-weight:bold">as</span> well
+  client.ping()
+  <span style="color:#080;font-weight:bold">print</span> <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">'</span><span style="color:#D20">ping()</span><span style="color:#710">'</span></span>
 
-up2 = service.retrieve(<span style="color:#00D">2</span>)</code></pre></div></div>
+  sum = client.add(<span style="color:#00D">1</span>,<span style="color:#00D">1</span>)
+  <span style="color:#080;font-weight:bold">print</span> <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">'</span><span style="color:#D20">1+1=%d</span><span style="color:#710">'</span></span> % (<span style="color:#369;font-weight:bold">sum</span>)</code></pre>
     </div>
     <div class="tab-pane" id="3">
-      <div class="CodeRay"><div class="code"><pre><code class="language-cplusplus"><span style="color:#080;font-weight:bold">class</span> <span style="color:#B06;font-weight:bold">UserStorageHandler</span> : <span style="color:#088;font-weight:bold">virtual</span> <span style="color:#088;font-weight:bold">public</span> UserStorageIf {
- <span style="color:#088;font-weight:bold">public</span>:
-  UserStorageHandler() {
-    <span style="color:#777">// Your initialization goes here</span>
-  }
-
-<span style="color:#088;font-weight:bold">void</span> store(<span style="color:#088;font-weight:bold">const</span> UserProfile&amp; user) {
-    <span style="color:#777">// Your implementation goes here</span>
-    printf(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">store</span><span style="color:#b0b">\n</span><span style="color:#710">"</span></span>);
-  }
-
-<span style="color:#088;font-weight:bold">void</span> retrieve(UserProfile&amp; <span style="color:#080;font-weight:bold">return</span>, <span style="color:#088;font-weight:bold">const</span> int32t uid) {
-    <span style="color:#777">// Your implementation goes here</span>
-    printf(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">retrieve</span><span style="color:#b0b">\n</span><span style="color:#710">"</span></span>);
-  }
-};
-
-<span style="color:#0a5;font-weight:bold">int</span> main(<span style="color:#0a5;font-weight:bold">int</span> argc, <span style="color:#0a5;font-weight:bold">char</span> **argv) {
-  <span style="color:#0a5;font-weight:bold">int</span> port = <span style="color:#00D">9090</span>;
-  sharedptr&lt;UserStorageHandler&gt; handler(<span style="color:#080;font-weight:bold">new</span> UserStorageHandler());
-  sharedptr&lt;TProcessor&gt; processor(<span style="color:#080;font-weight:bold">new</span> UserStorageProcessor(handler));
-  sharedptr&lt;TServerTransport&gt; serverTransport(<span style="color:#080;font-weight:bold">new</span> TServerSocket(port));
-  sharedptr&lt;TTransportFactory&gt; transportFactory(<span style="color:#080;font-weight:bold">new</span> TBufferedTransportFactory());
-  shared_ptr&lt;TProtocolFactory&gt; protocolFactory(<span style="color:#080;font-weight:bold">new</span> TBinaryProtocolFactory());
-  TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory);
-  server.serve();
-  <span style="color:#080;font-weight:bold">return</span> <span style="color:#00D">0</span>;
-}</code></pre></div></div>
+<pre><code class="language-java">    <span style="color:#080;font-weight:bold">try</span> {
+      TServerTransport serverTransport = <span style="color:#080;font-weight:bold">new</span> TServerSocket(<span style="color:#00D">9090</span>);
+      TServer server = <span style="color:#080;font-weight:bold">new</span> TSimpleServer(<span style="color:#080;font-weight:bold">new</span> Args(serverTransport).processor(processor));
+
+      <span style="color:#777">// Use this for a multithreaded server</span>
+      <span style="color:#777">// TServer server = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).processor(processor));</span>
+
+      <span style="color:#0a5;font-weight:bold">System</span>.out.println(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Starting the simple server...</span><span style="color:#710">"</span></span>);
+      server.serve();
+    } <span style="color:#080;font-weight:bold">catch</span> (<span style="color:#C00;font-weight:bold">Exception</span> e) {
+      e.printStackTrace();
+    }</code></pre>
     </div>
   </div>
 </div>
+
 	</div>
 	<div class="container">
 	<hr>

Modified: thrift/site/publish/mailing/index.html
URL: http://svn.apache.org/viewvc/thrift/site/publish/mailing/index.html?rev=1574384&r1=1574383&r2=1574384&view=diff
==============================================================================
--- thrift/site/publish/mailing/index.html (original)
+++ thrift/site/publish/mailing/index.html Wed Mar  5 05:40:00 2014
@@ -70,31 +70,40 @@
 
 <p>All project discussion is carried out publicly, on the following archived lists.</p>
 
-<hr><h3>User Mailing List</h3>
+<hr>
+
+<h3>User Mailing List</h3>
 
 <p>If you use Apache Thrift, please subscribe to the Thrift user mailing list. This list is for questions about Thrift and announcements from the team relevant to all users</p>
 
 <p><a href="mailto:user-subscribe@thrift.apache.org">Subscribe</a> | <a href="mailto:user-unsubscribe@thrift.apache.org">Unsubscribe</a> | <a href="http://mail-archives.apache.org/mod_mbox/thrift-user/">View Archives</a> | <a href="http://mail-archives.apache.org/mod_mbox/incubator-thrift-user/">View Archives (Incubator)</a></p>
 
-<hr><h3>Developers Mailing List</h3>
+<hr>
+
+<h3>Developers Mailing List</h3>
 
 <p>If you would like to contribute to Apache Thrift, subscribe to the Thrift developer mailing list.</p>
 
 <p><a href="mailto:dev-subscribe@thrift.apache.org">Subscribe</a> | <a href="mailto:dev-unsubscribe@thrift.apache.org">Unsubscribe</a> | <a href="http://mail-archives.apache.org/mod_mbox/thrift-dev/">View Archives</a> | <a href="http://mail-archives.apache.org/mod_mbox/incubator-thrift-dev/">View Archives (Incubator)</a></p>
 
-<hr><h3>Commits Mailing List</h3>
+<hr>
+
+<h3>Commits Mailing List</h3>
 
 <p>This list receives notifications about all code changes made to Apache Thrift.</p>
 
 <p><a href="mailto:commits-subscribe@thrift.apache.org">Subscribe</a> | <a href="mailto:commits-unsubscribe@thrift.apache.org">Unsubscribe</a> | <a href="http://mail-archives.apache.org/mod_mbox/thrift-commits/">View Archives</a> | <a href="http://mail-archives.apache.org/mod_mbox/incubator-thrift-commits/">View Archives (Incubator)</a></p>
 
-<hr><p>Note: subscription is required to post to all lists.</p>
+<hr>
+
+<p>Note: subscription is required to post to all lists.</p>
 
 <h3>IRC</h3>
 
 <p>Many of the Apache Thrift developers and community members hang out in the #thrift channel on irc.freenode.net.</p>
 
 <p>If you are new to IRC, you can use a client such as <a href="http://www.xchat.org/">xchat</a> or <a href="http://www.irssi.org/">Irssi</a> or a <a href="http://webchat.freenode.net/?channels=#thrift">web-based client</a>.</p>
+
 	</div>
 	<div class="container">
 	<hr>

Modified: thrift/site/publish/sitemap/index.html
URL: http://svn.apache.org/viewvc/thrift/site/publish/sitemap/index.html?rev=1574384&r1=1574383&r2=1574384&view=diff
==============================================================================
--- thrift/site/publish/sitemap/index.html (original)
+++ thrift/site/publish/sitemap/index.html Wed Mar  5 05:40:00 2014
@@ -67,20 +67,22 @@
 
   	<div class="container">
 		<ul>
-<li>
+    <li>
     <a href="/">Home</a>
     </li>
     
             <li><a href="/about/">About</a></li>
     
+            <li><a href="/developers/">Developers</a></li>
+    
             <li>
 <a href="/docs/">Documentation</a><ul>
-<li><a href="/docs/BuildingFromSource/">Building From Source</a></li>   <li><a href="/docs/concepts/">Concepts</a></li> <li><a href="/docs/features/">Features</a></li> <li><a href="/docs/HowToContribute/">How To Contribute</a></li> <li>
+    <li><a href="/docs/BuildingFromSource/">Building From Source</a></li>   <li><a href="/docs/concepts/">Concepts</a></li> <li><a href="/docs/features/">Features</a></li> <li><a href="/docs/HowToContribute/">How To Contribute</a></li> <li>
 <a href="/docs/committers/">Information for Committers</a>  <ul>
-<li><a href="/docs/committers/AdditionalReading/">General articles and links for committers</a></li>        <li><a href="/docs/committers/HowToRelease/">How to create a release</a></li>       <li><a href="/docs/committers/HowToPublish/">How to publish a release</a></li>      <li><a href="/docs/committers/HowToThriftWebsite/">How to update the website</a></li>       <li><a href="/docs/committers/HowToVersion/">How to version client libraries</a></li>   </ul>
+        <li><a href="/docs/committers/AdditionalReading/">General articles and links for committers</a></li>        <li><a href="/docs/committers/HowToRelease/">How to create a release</a></li>       <li><a href="/docs/committers/HowToPublish/">How to publish a release</a></li>      <li><a href="/docs/committers/HowToThriftWebsite/">How to update the website</a></li>       <li><a href="/docs/committers/HowToVersion/">How to version client libraries</a></li>   </ul>
 </li>   <li>
 <a href="/docs/install/">Installation Tutorials</a> <ul>
-<li><a href="/docs/install/centos/">Centos Install</a></li>     <li><a href="/docs/install/os_x/">OS X Install</a></li>     <li><a href="/docs/install/ubuntu/">Ubuntu Install</a></li>     <li><a href="/docs/install/windows/">Windows Install</a></li>   </ul>
+        <li><a href="/docs/install/centos/">Centos Install</a></li>     <li><a href="/docs/install/os_x/">OS X Install</a></li>     <li><a href="/docs/install/ubuntu/">Ubuntu Install</a></li>     <li><a href="/docs/install/windows/">Windows Install</a></li>   </ul>
 </li>   <li><a href="/docs/idl/">Interface Description Language (IDL)</a></li>  <li><a href="/docs/types/">Thrift Type system</a></li>
 </ul>
 </li>
@@ -93,13 +95,12 @@
     
             <li>
 <a href="/tutorial/">Tutorial</a><ul>
-<li><a href="/tutorial/as3/">As3</a></li>   <li><a href="/tutorial/c_glib/">C Glib</a></li> <li><a href="/tutorial/cpp/">C++</a></li>   <li><a href="/tutorial/csharp/">CSharp</a></li> <li><a href="/tutorial/d/">D</a></li>   <li><a href="/tutorial/delphi/">Delphi</a></li> <li><a href="/tutorial/erl/">Erlang</a></li>    <li><a href="/tutorial/go/">Go</a></li> <li><a href="/tutorial/graphviz/">Graphviz</a></li> <li><a href="/tutorial/hs/">Haskell</a></li>    <li><a href="/tutorial/java/">Java</a></li> <li><a href="/tutorial/javame/">Java Me</a></li>    <li><a href="/tutorial/js/">Javascript</a></li> <li><a href="/tutorial/nodejs/">Node.js</a></li>    <li><a href="/tutorial/cocoa/">Objective-c</a></li> <li><a href="/tutorial/ocaml/">OCaml</a></li>   <li><a href="/tutorial/perl/">Perl</a></li> <li><a href="/tutorial/php/">PHP</a></li>   <li><a href="/tutorial/py/">Python</a></li> <li><a href="/tutorial/rb/">Ruby</a></li>   <li><a href="/tutorial/st/">Smalltalk</a></li>
+    <li><a href="/tutorial/cpp/">C++</a></li>   <li><a href="/tutorial/csharp/">CSharp</a></li> <li><a href="/tutorial/d/">D</a></li>   <li><a href="/tutorial/delphi/">Delphi</a></li> <li><a href="/tutorial/go/">Go</a></li> <li><a href="/tutorial/graphviz/">Graphviz</a></li> <li><a href="/tutorial/hs/">Haskell</a></li>    <li><a href="/tutorial/java/">Java</a></li> <li><a href="/tutorial/js/">Javascript</a></li> <li><a href="/tutorial/nodejs/">Node.js</a></li>    <li><a href="/tutorial/ocaml/">OCaml</a></li>   <li><a href="/tutorial/perl/">Perl</a></li> <li><a href="/tutorial/php/">PHP</a></li>   <li><a href="/tutorial/py/">Python</a></li> <li><a href="/tutorial/rb/">Ruby</a></li>   <li><a href="/tutorial/st/">Smalltalk</a></li>
 </ul>
 </li>
     
-            <li><a href="/developers/">Developers</a></li>
-    
 </ul>
+
 	</div>
 	<div class="container">
 	<hr>

Modified: thrift/site/publish/tutorial/as3/index.html
URL: http://svn.apache.org/viewvc/thrift/site/publish/tutorial/as3/index.html?rev=1574384&r1=1574383&r2=1574384&view=diff
==============================================================================
--- thrift/site/publish/tutorial/as3/index.html (original)
+++ thrift/site/publish/tutorial/as3/index.html Wed Mar  5 05:40:00 2014
@@ -68,28 +68,33 @@
   	<div class="container">
 		<h2>As3 Tutorial</h2>
 
-<hr><h3>Introduction</h3>
+<hr>
+
+<h3>Introduction</h3>
 
 <p>All Apache Thrift tutorials require that you have:</p>
 
 <ol>
-<li>Built and installed the Apache Thrift Compiler and Libraries, see <a href="/docs/BuildingFromSource/">Building from source</a> for more details. </li>
+<li>Built and installed the Apache Thrift Compiler and Libraries, see <a href="/docs/BuildingFromSource/">Building from source</a> for more details.</li>
 <li>
 <p>Generated the <a href="https://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob_plain;f=tutorial/tutorial.thrift">tutorial.thrift</a> file as <a href="/tutorial/">discussed here</a></p>
 
 <pre><code>thrift -r --gen as3 tutorial.thrift
 </code></pre>
 </li>
-<li><p>Followed all prerequesets listed </p></li>
-</ol><h3>Prerequisites</h3>
+<li><p>Followed all prerequesets listed</p></li>
+</ol>
+
+<h3>Prerequisites</h3>
 
 <h3>Client</h3>
 
-<div class="CodeRay"><div class="code"><pre><code class="language-java"></code></pre></div></div>
+<pre><code class="language-java"></code></pre>
 
 <h3>Server</h3>
 
 <h2>Additional Information</h2>
+
 	</div>
 	<div class="container">
 	<hr>

Modified: thrift/site/publish/tutorial/c_glib/index.html
URL: http://svn.apache.org/viewvc/thrift/site/publish/tutorial/c_glib/index.html?rev=1574384&r1=1574383&r2=1574384&view=diff
==============================================================================
--- thrift/site/publish/tutorial/c_glib/index.html (original)
+++ thrift/site/publish/tutorial/c_glib/index.html Wed Mar  5 05:40:00 2014
@@ -68,28 +68,33 @@
   	<div class="container">
 		<h2>C Glib Tutorial</h2>
 
-<hr><h3>Introduction</h3>
+<hr>
+
+<h3>Introduction</h3>
 
 <p>All Apache Thrift tutorials require that you have:</p>
 
 <ol>
-<li>Built and installed the Apache Thrift Compiler and Libraries, see <a href="/docs/BuildingFromSource/">Building from source</a> for more details. </li>
+<li>Built and installed the Apache Thrift Compiler and Libraries, see <a href="/docs/BuildingFromSource/">Building from source</a> for more details.</li>
 <li>
 <p>Generated the <a href="https://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob_plain;f=tutorial/tutorial.thrift">tutorial.thrift</a> file as <a href="/tutorial/">discussed here</a></p>
 
 <pre><code>thrift -r --gen c_glib tutorial.thrift
 </code></pre>
 </li>
-<li><p>Followed all prerequesets listed </p></li>
-</ol><h3>Prerequisites</h3>
+<li><p>Followed all prerequesets listed</p></li>
+</ol>
+
+<h3>Prerequisites</h3>
 
 <h3>Client</h3>
 
-<div class="CodeRay"><div class="code"><pre><code class="language-java"></code></pre></div></div>
+<pre><code class="language-java"></code></pre>
 
 <h3>Server</h3>
 
 <h2>Additional Information</h2>
+
 	</div>
 	<div class="container">
 	<hr>

Modified: thrift/site/publish/tutorial/cocoa/index.html
URL: http://svn.apache.org/viewvc/thrift/site/publish/tutorial/cocoa/index.html?rev=1574384&r1=1574383&r2=1574384&view=diff
==============================================================================
--- thrift/site/publish/tutorial/cocoa/index.html (original)
+++ thrift/site/publish/tutorial/cocoa/index.html Wed Mar  5 05:40:00 2014
@@ -68,28 +68,33 @@
   	<div class="container">
 		<h2>Objective-c Tutorial</h2>
 
-<hr><h3>Introduction</h3>
+<hr>
+
+<h3>Introduction</h3>
 
 <p>All Apache Thrift tutorials require that you have:</p>
 
 <ol>
-<li>Built and installed the Apache Thrift Compiler and Libraries, see <a href="/docs/BuildingFromSource/">Building from source</a> for more details. </li>
+<li>Built and installed the Apache Thrift Compiler and Libraries, see <a href="/docs/BuildingFromSource/">Building from source</a> for more details.</li>
 <li>
 <p>Generated the <a href="https://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob_plain;f=tutorial/tutorial.thrift">tutorial.thrift</a> file as <a href="/tutorial/">discussed here</a></p>
 
 <pre><code>thrift -r --gen cocoa tutorial.thrift
 </code></pre>
 </li>
-<li><p>Followed all prerequesets listed </p></li>
-</ol><h3>Prerequisites</h3>
+<li><p>Followed all prerequesets listed</p></li>
+</ol>
+
+<h3>Prerequisites</h3>
 
 <h3>Client</h3>
 
-<div class="CodeRay"><div class="code"><pre><code class="language-c"></code></pre></div></div>
+<pre><code class="language-c"></code></pre>
 
 <h3>Server</h3>
 
 <h2>Additional Information</h2>
+
 	</div>
 	<div class="container">
 	<hr>

Modified: thrift/site/publish/tutorial/cpp/index.html
URL: http://svn.apache.org/viewvc/thrift/site/publish/tutorial/cpp/index.html?rev=1574384&r1=1574383&r2=1574384&view=diff
==============================================================================
--- thrift/site/publish/tutorial/cpp/index.html (original)
+++ thrift/site/publish/tutorial/cpp/index.html Wed Mar  5 05:40:00 2014
@@ -68,26 +68,49 @@
   	<div class="container">
 		<h2>C++ Tutorial</h2>
 
-<hr><h3>Introduction</h3>
+<hr>
+
+<h3>Introduction</h3>
 
 <p>All Apache Thrift tutorials require that you have:</p>
 
 <ol>
-<li>Built and installed the Apache Thrift Compiler and Libraries, see <a href="/docs/BuildingFromSource/">Building from source</a> for more details. </li>
+<li>Built and installed the Apache Thrift Compiler and Libraries, see <a href="/docs/BuildingFromSource/">Building from source</a> for more details.</li>
 <li>
 <p>Generated the <a href="https://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob_plain;f=tutorial/tutorial.thrift">tutorial.thrift</a> file as <a href="/tutorial/">discussed here</a></p>
 
 <pre><code>thrift -r --gen cpp tutorial.thrift
 </code></pre>
 </li>
-<li><p>Followed all prerequesets listed </p></li>
-</ol><h3>Prerequisites</h3>
+<li><p>Followed all prerequesets listed</p></li>
+</ol>
+
+<h3>Prerequisites</h3>
 
 <h3>Client</h3>
 
-<div class="CodeRay"><div class="code"><pre><code class="language-cpp">  shared_ptr&lt;TTransport&gt; socket(<span style="color:#080;font-weight:bold">new</span> TSocket(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">localhost</span><span style="color:#710">"</span></span>, <span style="color:#00D">9090</span>));
-  shared_ptr&lt;TTransport&gt; transport(<span style="color:#080;font-weight:bold">new</span> TBufferedTransport(socket));
-  shared_ptr&lt;TProtocol&gt; protocol(<span style="color:#080;font-weight:bold">new</span> TBinaryProtocol(transport));
+<pre><code class="language-cpp"><span style="color:#579">#include</span> <span style="color:#B44;font-weight:bold">&lt;stdio.h&gt;</span>
+<span style="color:#579">#include</span> <span style="color:#B44;font-weight:bold">&lt;unistd.h&gt;</span>
+<span style="color:#579">#include</span> <span style="color:#B44;font-weight:bold">&lt;sys/time.h&gt;</span>
+
+<span style="color:#579">#include</span> <span style="color:#B44;font-weight:bold">&lt;thrift/protocol/TBinaryProtocol.h&gt;</span>
+<span style="color:#579">#include</span> <span style="color:#B44;font-weight:bold">&lt;thrift/transport/TSocket.h&gt;</span>
+<span style="color:#579">#include</span> <span style="color:#B44;font-weight:bold">&lt;thrift/transport/TTransportUtils.h&gt;</span>
+
+<span style="color:#579">#include</span> <span style="color:#B44;font-weight:bold">"../gen-cpp/Calculator.h"</span>
+
+<span style="color:#088;font-weight:bold">using</span> <span style="color:#080;font-weight:bold">namespace</span> std;
+<span style="color:#088;font-weight:bold">using</span> <span style="color:#080;font-weight:bold">namespace</span> apache::thrift;
+<span style="color:#088;font-weight:bold">using</span> <span style="color:#080;font-weight:bold">namespace</span> apache::thrift::protocol;
+<span style="color:#088;font-weight:bold">using</span> <span style="color:#080;font-weight:bold">namespace</span> apache::thrift::transport;
+
+<span style="color:#088;font-weight:bold">using</span> <span style="color:#080;font-weight:bold">namespace</span> tutorial;
+<span style="color:#088;font-weight:bold">using</span> <span style="color:#080;font-weight:bold">namespace</span> shared;
+
+<span style="color:#0a5;font-weight:bold">int</span> main(<span style="color:#0a5;font-weight:bold">int</span> argc, <span style="color:#0a5;font-weight:bold">char</span>** argv) {
+  boost::shared_ptr&lt;TTransport&gt; socket(<span style="color:#080;font-weight:bold">new</span> TSocket(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">localhost</span><span style="color:#710">"</span></span>, <span style="color:#00D">9090</span>));
+  boost::shared_ptr&lt;TTransport&gt; transport(<span style="color:#080;font-weight:bold">new</span> TBufferedTransport(socket));
+  boost::shared_ptr&lt;TProtocol&gt; protocol(<span style="color:#080;font-weight:bold">new</span> TBinaryProtocol(transport));
   CalculatorClient client(protocol);
 
   <span style="color:#080;font-weight:bold">try</span> {
@@ -105,7 +128,7 @@
     work.num2 = <span style="color:#00D">0</span>;
 
     <span style="color:#080;font-weight:bold">try</span> {
-      int32_t quotient = client.calculate(<span style="color:#00D">1</span>, work);
+      client.calculate(<span style="color:#00D">1</span>, work);
       printf(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Whoa? We can divide by zero!</span><span style="color:#b0b">\n</span><span style="color:#710">"</span></span>);
     } <span style="color:#080;font-weight:bold">catch</span> (InvalidOperation &amp;io) {
       printf(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">InvalidOperation: %s</span><span style="color:#b0b">\n</span><span style="color:#710">"</span></span>, io.why.c_str());
@@ -126,27 +149,37 @@
     transport-&gt;close();
   } <span style="color:#080;font-weight:bold">catch</span> (TException &amp;tx) {
     printf(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">ERROR: %s</span><span style="color:#b0b">\n</span><span style="color:#710">"</span></span>, tx.what());
-  }</code></pre></div></div>
+  }
 
-<h3>Server</h3>
+}</code></pre>
 
-<div class="CodeRay"><div class="code"><pre><code class="language-cpp">  shared_ptr&lt;TProtocolFactory&gt; protocolFactory(<span style="color:#080;font-weight:bold">new</span> TBinaryProtocolFactory());
-  shared_ptr&lt;CalculatorHandler&gt; handler(<span style="color:#080;font-weight:bold">new</span> CalculatorHandler());
-  shared_ptr&lt;TProcessor&gt; processor(<span style="color:#080;font-weight:bold">new</span> CalculatorProcessor(handler));
-  shared_ptr&lt;TServerTransport&gt; serverTransport(<span style="color:#080;font-weight:bold">new</span> TServerSocket(<span style="color:#00D">9090</span>));
-  shared_ptr&lt;TTransportFactory&gt; transportFactory(<span style="color:#080;font-weight:bold">new</span> TBufferedTransportFactory());
-  
-  TSimpleServer server(processor, 
-                       serverTransport, 
-                       transportFactory, 
-                       protocolFactory);
+<h3>Server</h3>
 
-  printf(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Starting the server...</span><span style="color:#b0b">\n</span><span style="color:#710">"</span></span>);
-  server.serve();</code></pre></div></div>
+<pre><code class="language-cpp"><span style="color:#579">#include</span> <span style="color:#B44;font-weight:bold">&lt;thrift/concurrency/ThreadManager.h&gt;</span>
+<span style="color:#579">#include</span> <span style="color:#B44;font-weight:bold">&lt;thrift/concurrency/PosixThreadFactory.h&gt;</span>
+<span style="color:#579">#include</span> <span style="color:#B44;font-weight:bold">&lt;thrift/protocol/TBinaryProtocol.h&gt;</span>
+<span style="color:#579">#include</span> <span style="color:#B44;font-weight:bold">&lt;thrift/server/TSimpleServer.h&gt;</span>
+<span style="color:#579">#include</span> <span style="color:#B44;font-weight:bold">&lt;thrift/server/TThreadPoolServer.h&gt;</span>
+<span style="color:#579">#include</span> <span style="color:#B44;font-weight:bold">&lt;thrift/server/TThreadedServer.h&gt;</span>
+<span style="color:#579">#include</span> <span style="color:#B44;font-weight:bold">&lt;thrift/transport/TServerSocket.h&gt;</span>
+<span style="color:#579">#include</span> <span style="color:#B44;font-weight:bold">&lt;thrift/transport/TTransportUtils.h&gt;</span>
+
+<span style="color:#579">#include</span> <span style="color:#B44;font-weight:bold">&lt;iostream&gt;</span>
+<span style="color:#579">#include</span> <span style="color:#B44;font-weight:bold">&lt;stdexcept&gt;</span>
+<span style="color:#579">#include</span> <span style="color:#B44;font-weight:bold">&lt;sstream&gt;</span>
+
+<span style="color:#579">#include</span> <span style="color:#B44;font-weight:bold">"../gen-cpp/Calculator.h"</span>
+
+<span style="color:#088;font-weight:bold">using</span> <span style="color:#080;font-weight:bold">namespace</span> std;
+<span style="color:#088;font-weight:bold">using</span> <span style="color:#080;font-weight:bold">namespace</span> apache::thrift;
+<span style="color:#088;font-weight:bold">using</span> <span style="color:#080;font-weight:bold">namespace</span> apache::thrift::protocol;
+<span style="color:#088;font-weight:bold">using</span> <span style="color:#080;font-weight:bold">namespace</span> apache::thrift::transport;
+<span style="color:#088;font-weight:bold">using</span> <span style="color:#080;font-weight:bold">namespace</span> apache::thrift::server;
 
-<h3>Server Handler</h3>
+<span style="color:#088;font-weight:bold">using</span> <span style="color:#080;font-weight:bold">namespace</span> tutorial;
+<span style="color:#088;font-weight:bold">using</span> <span style="color:#080;font-weight:bold">namespace</span> shared;
 
-<div class="CodeRay"><div class="code"><pre><code class="language-cpp"><span style="color:#080;font-weight:bold">class</span> <span style="color:#B06;font-weight:bold">CalculatorHandler</span> : <span style="color:#088;font-weight:bold">public</span> CalculatorIf {
+<span style="color:#080;font-weight:bold">class</span> <span style="color:#B06;font-weight:bold">CalculatorHandler</span> : <span style="color:#088;font-weight:bold">public</span> CalculatorIf {
  <span style="color:#088;font-weight:bold">public</span>:
   CalculatorHandler() {}
 
@@ -210,16 +243,60 @@
   }
 
 <span style="color:#088;font-weight:bold">protected</span>:
-  map log;
+  map&lt;int32_t, SharedStruct&gt; log;
+
+};
 
-};</code></pre></div></div>
+<span style="color:#0a5;font-weight:bold">int</span> main(<span style="color:#0a5;font-weight:bold">int</span> argc, <span style="color:#0a5;font-weight:bold">char</span> **argv) {
+
+  boost::shared_ptr&lt;TProtocolFactory&gt; protocolFactory(<span style="color:#080;font-weight:bold">new</span> TBinaryProtocolFactory());
+  boost::shared_ptr&lt;CalculatorHandler&gt; handler(<span style="color:#080;font-weight:bold">new</span> CalculatorHandler());
+  boost::shared_ptr&lt;TProcessor&gt; processor(<span style="color:#080;font-weight:bold">new</span> CalculatorProcessor(handler));
+  boost::shared_ptr&lt;TServerTransport&gt; serverTransport(<span style="color:#080;font-weight:bold">new</span> TServerSocket(<span style="color:#00D">9090</span>));
+  boost::shared_ptr&lt;TTransportFactory&gt; transportFactory(<span style="color:#080;font-weight:bold">new</span> TBufferedTransportFactory());
+
+  TSimpleServer server(processor,
+                       serverTransport,
+                       transportFactory,
+                       protocolFactory);
+
+
+  <span style="color:#777">/**
+   * Or you could do one of these
+
+  boost::shared_ptr&lt;ThreadManager&gt; threadManager =
+    ThreadManager::newSimpleThreadManager(workerCount);
+  boost::shared_ptr&lt;PosixThreadFactory&gt; threadFactory =
+    boost::shared_ptr&lt;PosixThreadFactory&gt;(new PosixThreadFactory());
+  threadManager-&gt;threadFactory(threadFactory);
+  threadManager-&gt;start();
+  TThreadPoolServer server(processor,
+                           serverTransport,
+                           transportFactory,
+                           protocolFactory,
+                           threadManager);
+
+  TThreadedServer server(processor,
+                         serverTransport,
+                         transportFactory,
+                         protocolFactory);
+
+  */</span>
+
+  printf(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Starting the server...</span><span style="color:#b0b">\n</span><span style="color:#710">"</span></span>);
+  server.serve();
+  printf(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">done.</span><span style="color:#b0b">\n</span><span style="color:#710">"</span></span>);
+  <span style="color:#080;font-weight:bold">return</span> <span style="color:#00D">0</span>;
+}</code></pre>
 
 <h2>Additional Information</h2>
 
 <h3>Example ThreadPool Server</h3>
 
-<div class="CodeRay"><div class="code"><pre><code class="language-cpp">  shared_ptr&lt;ThreadManager&gt; threadManager =  ThreadManager::newSimpleThreadManager(workerCount);
-  shared_ptr&lt;PosixThreadFactory&gt; threadFactory = shared_ptr&lt;PosixThreadFactory&gt;(<span style="color:#080;font-weight:bold">new</span> PosixThreadFactory());
+<pre><code class="language-cpp">  boost::shared_ptr&lt;ThreadManager&gt; threadManager =
+    ThreadManager::newSimpleThreadManager(workerCount);
+  boost::shared_ptr&lt;PosixThreadFactory&gt; threadFactory =
+    boost::shared_ptr&lt;PosixThreadFactory&gt;(<span style="color:#080;font-weight:bold">new</span> PosixThreadFactory());
   threadManager-&gt;threadFactory(threadFactory);
   threadManager-&gt;start();
   TThreadPoolServer server(processor,
@@ -231,7 +308,8 @@
   TThreadedServer server(processor,
                          serverTransport,
                          transportFactory,
-                         protocolFactory);</code></pre></div></div>
+                         protocolFactory);</code></pre>
+
 	</div>
 	<div class="container">
 	<hr>

Modified: thrift/site/publish/tutorial/csharp/index.html
URL: http://svn.apache.org/viewvc/thrift/site/publish/tutorial/csharp/index.html?rev=1574384&r1=1574383&r2=1574384&view=diff
==============================================================================
--- thrift/site/publish/tutorial/csharp/index.html (original)
+++ thrift/site/publish/tutorial/csharp/index.html Wed Mar  5 05:40:00 2014
@@ -68,192 +68,216 @@
   	<div class="container">
 		<h2>CSharp Tutorial</h2>
 
-<hr><h3>Introduction</h3>
+<hr>
+
+<h3>Introduction</h3>
 
 <p>All Apache Thrift tutorials require that you have:</p>
 
 <ol>
-<li>Built and installed the Apache Thrift Compiler and Libraries, see <a href="/docs/BuildingFromSource/">Building from source</a> for more details. </li>
+<li>Built and installed the Apache Thrift Compiler and Libraries, see <a href="/docs/BuildingFromSource/">Building from source</a> for more details.</li>
 <li>
 <p>Generated the <a href="https://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob_plain;f=tutorial/tutorial.thrift">tutorial.thrift</a> file as <a href="/tutorial/">discussed here</a></p>
 
 <pre><code>thrift -r --gen csharp tutorial.thrift
 </code></pre>
 </li>
-<li><p>Followed all prerequesets listed </p></li>
-</ol><h3>Prerequisites</h3>
+<li><p>Followed all prerequesets listed</p></li>
+</ol>
+
+<h3>Prerequisites</h3>
 
 <h3>Client</h3>
 
-<p>The client uses the generated code to set up the connection and call the server. Our tutorial uses the binary protocol via sockets.</p>
+<pre><code class="language-cpp"><span style="color:#088;font-weight:bold">using</span> System;
+<span style="color:#088;font-weight:bold">using</span> Thrift;
+<span style="color:#088;font-weight:bold">using</span> Thrift.Protocol;
+<span style="color:#088;font-weight:bold">using</span> Thrift.Server;
+<span style="color:#088;font-weight:bold">using</span> Thrift.Transport;
 
-<div class="CodeRay"><div class="code"><pre><code class="language-c">public <span style="color:#088;font-weight:bold">static</span> <span style="color:#088;font-weight:bold">void</span> Main()
+
+<span style="color:#080;font-weight:bold">namespace</span> CSharpTutorial
 {
-    try
+    <span style="color:#088;font-weight:bold">public</span> <span style="color:#080;font-weight:bold">class</span> <span style="color:#B06;font-weight:bold">CSharpClient</span>
     {
-        TTransport transport = new TSocket(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">localhost</span><span style="color:#710">"</span></span>, <span style="color:#00D">9090</span>);
-        TProtocol protocol = new TBinaryProtocol(transport);
-        Calculator.Client client = new Calculator.Client(protocol);
-    
-        transport.Open();
-    
-        client.ping();
-        Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">ping()</span><span style="color:#710">"</span></span>);
-    
-        <span style="color:#0a5;font-weight:bold">int</span> sum = client.add(<span style="color:#00D">1</span>, <span style="color:#00D">1</span>);
-        Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">1+1={0}</span><span style="color:#710">"</span></span>, sum);
-    
-        Work work = new Work();
-    
-        work.Op = Operation.DIVIDE;
-        work.Num1 = <span style="color:#00D">1</span>;
-        work.Num2 = <span style="color:#00D">0</span>;
-        try
-        {
-            <span style="color:#0a5;font-weight:bold">int</span> quotient = client.calculate(<span style="color:#00D">1</span>, work);
-            Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Whoa we can divide by 0</span><span style="color:#710">"</span></span>);
-        }
-        catch (InvalidOperation io)
-        {
-            Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Invalid operation: </span><span style="color:#710">"</span></span> + io.Why);
-        }
-    
-        work.Op = Operation.SUBTRACT;
-        work.Num1 = <span style="color:#00D">15</span>;
-        work.Num2 = <span style="color:#00D">10</span>;
-        try
-        {
-            <span style="color:#0a5;font-weight:bold">int</span> diff = client.calculate(<span style="color:#00D">1</span>, work);
-            Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">15-10={0}</span><span style="color:#710">"</span></span>, diff);
-        }
-        catch (InvalidOperation io)
-        {
-            Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Invalid operation: </span><span style="color:#710">"</span></span> + io.Why);
-        }
-    
-        SharedStruct log = client.getStruct(<span style="color:#00D">1</span>);
-        Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Check log: {0}</span><span style="color:#710">"</span></span>, log.Value);
-    
-        transport.Close();
-    }
-    catch (TApplicationException x)
-    {
-        Console.WriteLine(x.StackTrace);
-    }
+        <span style="color:#088;font-weight:bold">public</span> <span style="color:#088;font-weight:bold">static</span> <span style="color:#088;font-weight:bold">void</span> Main()
+        {
+            <span style="color:#080;font-weight:bold">try</span>
+            {
+                TTransport transport = <span style="color:#080;font-weight:bold">new</span> TSocket(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">localhost</span><span style="color:#710">"</span></span>, <span style="color:#00D">9090</span>);
+                TProtocol protocol = <span style="color:#080;font-weight:bold">new</span> TBinaryProtocol(transport);
+                Calculator.Client client = <span style="color:#080;font-weight:bold">new</span> Calculator.Client(protocol);
 
-}</code></pre></div></div>
+                transport.Open();
+                <span style="color:#080;font-weight:bold">try</span>
+                {
+                    client.ping();
+                    Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">ping()</span><span style="color:#710">"</span></span>);
 
-<h3>Server</h3>
+                    <span style="color:#0a5;font-weight:bold">int</span> sum = client.add(<span style="color:#00D">1</span>, <span style="color:#00D">1</span>);
+                    Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">1+1={0}</span><span style="color:#710">"</span></span>, sum);
 
-<p>The server main code typically sets up the service endpoint as designed by the developer. The setup is quite similar to the client, except that we use the TServerSocket and need an interface handler instance which will handle the incoming requests.
-</p><div class="CodeRay"><div class="code"><pre><code class="language-c">public <span style="color:#088;font-weight:bold">static</span> <span style="color:#088;font-weight:bold">void</span> Main()
-{
-    try
-    {
-        CalculatorHandler handler = new CalculatorHandler();
-        Calculator.Processor processor = new Calculator.Processor(handler);
-        TServerTransport serverTransport = new TServerSocket(<span style="color:#00D">9090</span>);
-        TServer server = new TSimpleServer(processor, serverTransport);
-        Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Starting the server...</span><span style="color:#710">"</span></span>);
-        server.Serve();
-    }
-    catch (Exception x)
-    {
-        Console.WriteLine(x.StackTrace);
-    }
-    Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">done.</span><span style="color:#710">"</span></span>);
-}</code></pre></div></div>
+                    Work work = <span style="color:#080;font-weight:bold">new</span> Work();
 
-<h3>Server Handler</h3>
+                    work.Op = Operation.DIVIDE;
+                    work.Num1 = <span style="color:#00D">1</span>;
+                    work.Num2 = <span style="color:#00D">0</span>;
+                    <span style="color:#080;font-weight:bold">try</span>
+                    {
+                        <span style="color:#0a5;font-weight:bold">int</span> quotient = client.calculate(<span style="color:#00D">1</span>, work);
+                        Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Whoa we can divide by 0</span><span style="color:#710">"</span></span>);
+                    }
+                    <span style="color:#080;font-weight:bold">catch</span> (InvalidOperation io)
+                    {
+                        Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Invalid operation: </span><span style="color:#710">"</span></span> + io.Why);
+                    }
+
+                    work.Op = Operation.SUBTRACT;
+                    work.Num1 = <span style="color:#00D">15</span>;
+                    work.Num2 = <span style="color:#00D">10</span>;
+                    <span style="color:#080;font-weight:bold">try</span>
+                    {
+                        <span style="color:#0a5;font-weight:bold">int</span> diff = client.calculate(<span style="color:#00D">1</span>, work);
+                        Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">15-10={0}</span><span style="color:#710">"</span></span>, diff);
+                    }
+                    <span style="color:#080;font-weight:bold">catch</span> (InvalidOperation io)
+                    {
+                        Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Invalid operation: </span><span style="color:#710">"</span></span> + io.Why);
+                    }
 
-<p>The server handler class CalculatorHandler implements the communication endpoint interface. The Calculator.Iface interface implemented here is again created by the Thrift compiler from the IDL.</p>
+                    SharedStruct log = client.getStruct(<span style="color:#00D">1</span>);
+                    Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Check log: {0}</span><span style="color:#710">"</span></span>, log.Value);
 
-<div class="CodeRay"><div class="code"><pre><code class="language-c">public class CalculatorHandler : Calculator.Iface
-{
-    Dictionary log;
-
-    public CalculatorHandler()
-    {
-        log = new Dictionary();
-    }
-    
-    public <span style="color:#088;font-weight:bold">void</span> ping()
-    {
-        Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">ping()</span><span style="color:#710">"</span></span>);
-    }
-    
-    public <span style="color:#0a5;font-weight:bold">int</span> add(<span style="color:#0a5;font-weight:bold">int</span> n1, <span style="color:#0a5;font-weight:bold">int</span> n2)
-    {
-        Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">add({0},{1})</span><span style="color:#710">"</span></span>, n1, n2);
-        <span style="color:#080;font-weight:bold">return</span> n1 + n2;
-    }
-    
-    public <span style="color:#0a5;font-weight:bold">int</span> calculate(<span style="color:#0a5;font-weight:bold">int</span> logid, Work work)
-    {
-        Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">calculate({0}, [{1},{2},{3}])</span><span style="color:#710">"</span></span>, logid, work.Op, work.Num1, work.Num2);
-        <span style="color:#0a5;font-weight:bold">int</span> val = <span style="color:#00D">0</span>;
-        <span style="color:#080;font-weight:bold">switch</span> (work.Op)
-        {
-            <span style="color:#080;font-weight:bold">case</span> Operation.ADD:
-                val = work.Num1 + work.Num2;
-                <span style="color:#080;font-weight:bold">break</span>;
-    
-            <span style="color:#080;font-weight:bold">case</span> Operation.SUBTRACT:
-                val = work.Num1 - work.Num2;
-                <span style="color:#080;font-weight:bold">break</span>;
-    
-            <span style="color:#080;font-weight:bold">case</span> Operation.MULTIPLY:
-                val = work.Num1 * work.Num2;
-                <span style="color:#080;font-weight:bold">break</span>;
-    
-            <span style="color:#080;font-weight:bold">case</span> Operation.DIVIDE:
-                <span style="color:#080;font-weight:bold">if</span> (work.Num2 == <span style="color:#00D">0</span>)
-                {
-                    InvalidOperation io = new InvalidOperation();
-                    io.What = (<span style="color:#0a5;font-weight:bold">int</span>)work.Op;
-                    io.Why = <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Cannot divide by 0</span><span style="color:#710">"</span></span>;
-                    throw io;
                 }
-                val = work.Num1 / work.Num2;
-                <span style="color:#080;font-weight:bold">break</span>;
-    
-            <span style="color:#080;font-weight:bold">default</span>:
+                finally
                 {
-                    InvalidOperation io = new InvalidOperation();
-                    io.What = (<span style="color:#0a5;font-weight:bold">int</span>)work.Op;
-                    io.Why = <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Unknown operation</span><span style="color:#710">"</span></span>;
-                    throw io;
+                    transport.Close();
                 }
+            }
+            <span style="color:#080;font-weight:bold">catch</span> (TApplicationException x)
+            {
+                Console.WriteLine(x.StackTrace);
+            }
+
         }
-    
-        SharedStruct entry = new SharedStruct();
-        entry.Key = logid;
-        entry.Value = val.ToString();
-        log[logid] = entry;
-    
-        <span style="color:#080;font-weight:bold">return</span> val;
     }
-    
-    public SharedStruct getStruct(<span style="color:#0a5;font-weight:bold">int</span> key)
+}</code></pre>
+
+<h3>Server</h3>
+
+<pre><code class="language-cpp"><span style="color:#088;font-weight:bold">using</span> System;
+<span style="color:#088;font-weight:bold">using</span> System.Collections.Generic;
+<span style="color:#088;font-weight:bold">using</span> Thrift.Server;
+<span style="color:#088;font-weight:bold">using</span> Thrift.Transport;
+
+<span style="color:#080;font-weight:bold">namespace</span> CSharpTutorial
+{
+    <span style="color:#088;font-weight:bold">public</span> <span style="color:#080;font-weight:bold">class</span> <span style="color:#B06;font-weight:bold">CalculatorHandler</span> : Calculator.Iface
     {
-        Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">getStruct({0})</span><span style="color:#710">"</span></span>, key);
-        <span style="color:#080;font-weight:bold">return</span> log[key];
+        Dictionary&lt;<span style="color:#0a5;font-weight:bold">int</span>, SharedStruct&gt; log;
+
+        <span style="color:#088;font-weight:bold">public</span> CalculatorHandler()
+        {
+            log = <span style="color:#080;font-weight:bold">new</span> Dictionary&lt;<span style="color:#0a5;font-weight:bold">int</span>, SharedStruct&gt;();
+        }
+
+        <span style="color:#088;font-weight:bold">public</span> <span style="color:#088;font-weight:bold">void</span> ping()
+        {
+            Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">ping()</span><span style="color:#710">"</span></span>);
+        }
+
+        <span style="color:#088;font-weight:bold">public</span> <span style="color:#0a5;font-weight:bold">int</span> add(<span style="color:#0a5;font-weight:bold">int</span> n1, <span style="color:#0a5;font-weight:bold">int</span> n2)
+        {
+            Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">add({0},{1})</span><span style="color:#710">"</span></span>, n1, n2);
+            <span style="color:#080;font-weight:bold">return</span> n1 + n2;
+        }
+
+        <span style="color:#088;font-weight:bold">public</span> <span style="color:#0a5;font-weight:bold">int</span> calculate(<span style="color:#0a5;font-weight:bold">int</span> logid, Work work)
+        {
+            Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">calculate({0}, [{1},{2},{3}])</span><span style="color:#710">"</span></span>, logid, work.Op, work.Num1, work.Num2);
+            <span style="color:#0a5;font-weight:bold">int</span> val = <span style="color:#00D">0</span>;
+            <span style="color:#080;font-weight:bold">switch</span> (work.Op)
+            {
+                <span style="color:#080;font-weight:bold">case</span> Operation.ADD:
+                    val = work.Num1 + work.Num2;
+                    <span style="color:#080;font-weight:bold">break</span>;
+
+                <span style="color:#080;font-weight:bold">case</span> Operation.SUBTRACT:
+                    val = work.Num1 - work.Num2;
+                    <span style="color:#080;font-weight:bold">break</span>;
+
+                <span style="color:#080;font-weight:bold">case</span> Operation.MULTIPLY:
+                    val = work.Num1 * work.Num2;
+                    <span style="color:#080;font-weight:bold">break</span>;
+
+                <span style="color:#080;font-weight:bold">case</span> Operation.DIVIDE:
+                    <span style="color:#080;font-weight:bold">if</span> (work.Num2 == <span style="color:#00D">0</span>)
+                    {
+                        InvalidOperation io = <span style="color:#080;font-weight:bold">new</span> InvalidOperation();
+                        io.What = (<span style="color:#0a5;font-weight:bold">int</span>)work.Op;
+                        io.Why = <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Cannot divide by 0</span><span style="color:#710">"</span></span>;
+                        <span style="color:#080;font-weight:bold">throw</span> io;
+                    }
+                    val = work.Num1 / work.Num2;
+                    <span style="color:#080;font-weight:bold">break</span>;
+
+                <span style="color:#080;font-weight:bold">default</span>:
+                    {
+                        InvalidOperation io = <span style="color:#080;font-weight:bold">new</span> InvalidOperation();
+                        io.What = (<span style="color:#0a5;font-weight:bold">int</span>)work.Op;
+                        io.Why = <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Unknown operation</span><span style="color:#710">"</span></span>;
+                        <span style="color:#080;font-weight:bold">throw</span> io;
+                    }
+            }
+
+            SharedStruct entry = <span style="color:#080;font-weight:bold">new</span> SharedStruct();
+            entry.Key = logid;
+            entry.Value = val.ToString();
+            log[logid] = entry;
+
+            <span style="color:#080;font-weight:bold">return</span> val;
+        }
+
+        <span style="color:#088;font-weight:bold">public</span> SharedStruct getStruct(<span style="color:#0a5;font-weight:bold">int</span> key)
+        {
+            Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">getStruct({0})</span><span style="color:#710">"</span></span>, key);
+            <span style="color:#080;font-weight:bold">return</span> log[key];
+        }
+
+        <span style="color:#088;font-weight:bold">public</span> <span style="color:#088;font-weight:bold">void</span> zip()
+        {
+            Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">zip()</span><span style="color:#710">"</span></span>);
+        }
     }
-    
-    public <span style="color:#088;font-weight:bold">void</span> zip()
+
+    <span style="color:#088;font-weight:bold">public</span> <span style="color:#080;font-weight:bold">class</span> <span style="color:#B06;font-weight:bold">CSharpServer</span>
     {
-        Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">zip()</span><span style="color:#710">"</span></span>);
+        <span style="color:#088;font-weight:bold">public</span> <span style="color:#088;font-weight:bold">static</span> <span style="color:#088;font-weight:bold">void</span> Main()
+        {
+            <span style="color:#080;font-weight:bold">try</span>
+            {
+                CalculatorHandler handler = <span style="color:#080;font-weight:bold">new</span> CalculatorHandler();
+                Calculator.Processor processor = <span style="color:#080;font-weight:bold">new</span> Calculator.Processor(handler);
+                TServerTransport serverTransport = <span style="color:#080;font-weight:bold">new</span> TServerSocket(<span style="color:#00D">9090</span>);
+                TServer server = <span style="color:#080;font-weight:bold">new</span> TSimpleServer(processor, serverTransport);
+
+                <span style="color:#777">// Use this for a multithreaded server</span>
+                <span style="color:#777">// server = new TThreadPoolServer(processor, serverTransport);</span>
+
+                Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Starting the server...</span><span style="color:#710">"</span></span>);
+                server.Serve();
+            }
+            <span style="color:#080;font-weight:bold">catch</span> (Exception x)
+            {
+                Console.WriteLine(x.StackTrace);
+            }
+            Console.WriteLine(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">done.</span><span style="color:#710">"</span></span>);
+        }
     }
-}</code></pre></div></div>
+}</code></pre>
 
 <h2>Additional Information</h2>
 
-<p>Thrift offers a lot more options. For example, in order to use a multithreaded server that can serve multiple requests in parallel, replace the line
-</p><div class="CodeRay"><div class="code"><pre><code class="language-c">    TServer server = new TSimpleServer(processor, serverTransport);</code></pre></div></div>
-
-<p>with this code: </p>
-
-<div class="CodeRay"><div class="code"><pre><code class="language-c">    TServer server = new TThreadPoolServer(processor, serverTransport);</code></pre></div></div>
 	</div>
 	<div class="container">
 	<hr>

Modified: thrift/site/publish/tutorial/d/index.html
URL: http://svn.apache.org/viewvc/thrift/site/publish/tutorial/d/index.html?rev=1574384&r1=1574383&r2=1574384&view=diff
==============================================================================
--- thrift/site/publish/tutorial/d/index.html (original)
+++ thrift/site/publish/tutorial/d/index.html Wed Mar  5 05:40:00 2014
@@ -68,28 +68,172 @@
   	<div class="container">
 		<h2>D Tutorial</h2>
 
-<hr><h3>Introduction</h3>
+<hr>
+
+<h3>Introduction</h3>
 
 <p>All Apache Thrift tutorials require that you have:</p>
 
 <ol>
-<li>Built and installed the Apache Thrift Compiler and Libraries, see <a href="/docs/BuildingFromSource/">Building from source</a> for more details. </li>
+<li>Built and installed the Apache Thrift Compiler and Libraries, see <a href="/docs/BuildingFromSource/">Building from source</a> for more details.</li>
 <li>
 <p>Generated the <a href="https://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob_plain;f=tutorial/tutorial.thrift">tutorial.thrift</a> file as <a href="/tutorial/">discussed here</a></p>
 
 <pre><code>thrift -r --gen d tutorial.thrift
 </code></pre>
 </li>
-<li><p>Followed all prerequesets listed </p></li>
-</ol><h3>Prerequisites</h3>
+<li><p>Followed all prerequesets listed</p></li>
+</ol>
+
+<h3>Prerequisites</h3>
 
 <h3>Client</h3>
 
-<div class="CodeRay"><div class="code"><pre><code class="language-c"></code></pre></div></div>
+<pre><code class="language-cpp">module server;
+
+import std.conv : to;
+import std.stdio;
+import thrift.codegen.processor;
+import thrift.protocol.binary;
+import thrift.server.simple;
+import thrift.server.transport.socket;
+import thrift.transport.buffered;
+
+import share.SharedService;
+import share.shared_types;
+import tutorial.Calculator;
+import tutorial.tutorial_types;
+
+<span style="color:#777">/**
+ * The actual implementation of the Calculator interface that is called by
+ * the server to answer the requests.
+ */</span>
+<span style="color:#080;font-weight:bold">class</span> <span style="color:#B06;font-weight:bold">CalculatorHandler</span> : Calculator {
+  <span style="color:#088;font-weight:bold">void</span> ping() {
+    writeln(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">ping()</span><span style="color:#710">"</span></span>);
+  }
+
+  <span style="color:#0a5;font-weight:bold">int</span> add(<span style="color:#0a5;font-weight:bold">int</span> n1, <span style="color:#0a5;font-weight:bold">int</span> n2) {
+    writefln(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">add(%s,%s)</span><span style="color:#710">"</span></span>, n1, n2);
+    <span style="color:#080;font-weight:bold">return</span> n1 + n2;
+  }
+
+  <span style="color:#0a5;font-weight:bold">int</span> calculate(<span style="color:#0a5;font-weight:bold">int</span> logid, ref <span style="color:#088;font-weight:bold">const</span>(Work) work) {
+    writefln(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">calculate(%s, {%s, %s, %s})</span><span style="color:#710">"</span></span>, logid, work.op, work.num1, work.num2);
+    <span style="color:#0a5;font-weight:bold">int</span> val;
+
+    <span style="color:#080;font-weight:bold">switch</span> (work.op) {
+    <span style="color:#080;font-weight:bold">case</span> Operation.ADD:
+      val = work.num1 + work.num2;
+      <span style="color:#080;font-weight:bold">break</span>;
+    <span style="color:#080;font-weight:bold">case</span> Operation.SUBTRACT:
+      val = work.num1 - work.num2;
+      <span style="color:#080;font-weight:bold">break</span>;
+    <span style="color:#080;font-weight:bold">case</span> Operation.MULTIPLY:
+      val = work.num1 * work.num2;
+      <span style="color:#080;font-weight:bold">break</span>;
+    <span style="color:#080;font-weight:bold">case</span> Operation.DIVIDE:
+      <span style="color:#080;font-weight:bold">if</span> (work.num2 == <span style="color:#00D">0</span>) {
+        <span style="color:#088;font-weight:bold">auto</span> io = <span style="color:#080;font-weight:bold">new</span> InvalidOperation();
+        io.what = work.op;
+        io.why = <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Cannot divide by 0</span><span style="color:#710">"</span></span>;
+        <span style="color:#080;font-weight:bold">throw</span> io;
+      }
+      val = work.num1 / work.num2;
+      <span style="color:#080;font-weight:bold">break</span>;
+    <span style="color:#080;font-weight:bold">default</span>:
+      <span style="color:#088;font-weight:bold">auto</span> io = <span style="color:#080;font-weight:bold">new</span> InvalidOperation();
+      io.what = work.op;
+      io.why = <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Invalid Operation</span><span style="color:#710">"</span></span>;
+      <span style="color:#080;font-weight:bold">throw</span> io;
+    }
+
+    <span style="color:#088;font-weight:bold">auto</span> ss = SharedStruct();
+    ss.key = logid;
+    ss.value = to!<span style="color:#0a5;font-weight:bold">string</span>(val);
+    log[logid] = ss;
+
+    <span style="color:#080;font-weight:bold">return</span> val;
+  }
+
+  SharedStruct getStruct(<span style="color:#0a5;font-weight:bold">int</span> logid) {
+    writefln(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">getStruct(%s)</span><span style="color:#710">"</span></span>, logid);
+    <span style="color:#080;font-weight:bold">return</span> log[logid];
+  }
+
+  <span style="color:#088;font-weight:bold">void</span> zip() {
+    writeln(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">zip()</span><span style="color:#710">"</span></span>);
+  }
+
+<span style="color:#088;font-weight:bold">protected</span>:
+  SharedStruct[<span style="color:#0a5;font-weight:bold">int</span>] log;
+}
+
+<span style="color:#088;font-weight:bold">void</span> main() {
+  <span style="color:#088;font-weight:bold">auto</span> protocolFactory = <span style="color:#080;font-weight:bold">new</span> TBinaryProtocolFactory!();
+  <span style="color:#088;font-weight:bold">auto</span> processor = <span style="color:#080;font-weight:bold">new</span> TServiceProcessor!Calculator(<span style="color:#080;font-weight:bold">new</span> CalculatorHandler);
+  <span style="color:#088;font-weight:bold">auto</span> serverTransport = <span style="color:#080;font-weight:bold">new</span> TServerSocket(<span style="color:#00D">9090</span>);
+  <span style="color:#088;font-weight:bold">auto</span> transportFactory = <span style="color:#080;font-weight:bold">new</span> TBufferedTransportFactory;
+
+  <span style="color:#088;font-weight:bold">auto</span> server = <span style="color:#080;font-weight:bold">new</span> TSimpleServer(
+    processor, serverTransport, transportFactory, protocolFactory);
+
+  writeln(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Starting the server on port 9090...</span><span style="color:#710">"</span></span>);
+  server.serve();
+  writeln(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">done.</span><span style="color:#710">"</span></span>);
+}</code></pre>
 
 <h3>Server</h3>
 
+<pre><code class="language-cpp">module client;
+
+import std.stdio;
+import thrift.base;
+import thrift.codegen.client;
+import thrift.protocol.binary;
+import thrift.transport.buffered;
+import thrift.transport.socket;
+
+import tutorial.Calculator;
+import tutorial.tutorial_types;
+
+<span style="color:#088;font-weight:bold">void</span> main() {
+  <span style="color:#088;font-weight:bold">auto</span> socket = <span style="color:#080;font-weight:bold">new</span> TSocket(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">localhost</span><span style="color:#710">"</span></span>, <span style="color:#00D">9090</span>);
+  <span style="color:#088;font-weight:bold">auto</span> transport = <span style="color:#080;font-weight:bold">new</span> TBufferedTransport(socket);
+  <span style="color:#088;font-weight:bold">auto</span> protocol = tBinaryProtocol(transport);
+  <span style="color:#088;font-weight:bold">auto</span> client = tClient!Calculator(protocol);
+
+  transport.open();
+
+  client.ping();
+  writeln(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">ping()</span><span style="color:#710">"</span></span>);
+
+  <span style="color:#0a5;font-weight:bold">int</span> sum = client.add(<span style="color:#00D">1</span>, <span style="color:#00D">1</span>);
+  writefln(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">1 + 1 = %s</span><span style="color:#710">"</span></span>, sum);
+
+  <span style="color:#088;font-weight:bold">auto</span> work = Work();
+  work.op = Operation.DIVIDE;
+  work.num1 = <span style="color:#00D">1</span>;
+  work.num2 = <span style="color:#00D">0</span>;
+  <span style="color:#080;font-weight:bold">try</span> {
+    <span style="color:#0a5;font-weight:bold">int</span> quotient = client.calculate(<span style="color:#00D">1</span>, work);
+    writeln(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Whoa we can divide by 0</span><span style="color:#710">"</span></span>);
+  } <span style="color:#080;font-weight:bold">catch</span> (InvalidOperation io) {
+    writeln(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Invalid operation: </span><span style="color:#710">"</span></span> ~ io.why);
+  }
+
+  work.op = Operation.SUBTRACT;
+  work.num1 = <span style="color:#00D">15</span>;
+  work.num2 = <span style="color:#00D">10</span>;
+  <span style="color:#0a5;font-weight:bold">int</span> diff = client.calculate(<span style="color:#00D">1</span>, work);
+  writefln(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">15 - 10 = %s</span><span style="color:#710">"</span></span>, diff);
+
+  <span style="color:#088;font-weight:bold">auto</span> log = client.getStruct(<span style="color:#00D">1</span>);
+  writefln(<span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">"</span><span style="color:#D20">Check log: %s</span><span style="color:#710">"</span></span>, log.value);
+}</code></pre>
+
 <h2>Additional Information</h2>
+
 	</div>
 	<div class="container">
 	<hr>