Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
9il committed Apr 25, 2015
1 parent 8001d96 commit 4ffeb4a
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 135 deletions.
58 changes: 22 additions & 36 deletions docs/source/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ Examples

NOT READY!

D is complex multi-paradigm programming language. At the same time, if you know С programming language, to start using D you just need to look through some examples.
D is a complex multi-paradigm programming language. At the same time, if you know C programming language and you want to start using D then you just need to look through some examples.


Hellow Wolrd!
~~~~~~~~~~~~~~

C programs can be easily translated to D.
The following program prints "Hello, World!" to the standard output.

Expand All @@ -29,7 +30,7 @@ Module ``core.stdc.stdio`` contains the ``puts`` prototype:
extern(C) @system nothrow @nogc int puts(in char* s);
Common D "Hello, World!" program based on Phobos looks more simple:
Common D "Hello, World!" program which is based on Phobos looks more simple:

.. literalinclude:: ../../examples/helloworld2.d
:language: d
Expand All @@ -53,7 +54,7 @@ Plotting with matplotlib (python)
These are two projects that can be used with the D programming language:

+ Plotcli_ is a command line application written in D that can create plots from text/csv files and from piped data, making it useful during data analysis.
+ PLplot_ is a cross-platform software package written in С for creating scientific plots. It includes low-level D bindings.
+ PLplot_ is a cross-platform software package written in C for creating scientific plots. It includes low-level D bindings.

But these two are not so convenient to use, in comparison with matplotlib.

Expand Down Expand Up @@ -86,60 +87,46 @@ reads data from a file and shows the histogram.
Web Application
~~~~~~~~~~~~~~~

Web application это довольно хороший пример для последних глав
книги, где читателю предлагается вполной мере воспользоваться средствами
выразительности языка. То есть, как правило, web application
представляет из себя сложный продукт, как с точки зрения
знания языка, так и с точки зрения сложности используемых при этом библиотек
(тут наверное не стоит дословно переводить).

И данный пример не является исключением. Тогда зачем он нужен людям желающим
предельно быстро ознакомитсься с языком? Для многих из них, такая причина есть,
и заклюяается она в том, что им необходимо быстро интегрировать
программы написанные на D с другими сервисами, языками программирования и базами данных.
Web application is a pretty good example of the last chapters of the book, where the reader is suggested to make use of the means of expression in the language. As a rule, web application is a complex product, both in terms of knowledge of the language and in terms of complexity used in this library.

В качестве основы для данного примера взята статья
"Сreating a simple restful web app with node.js, Express, and MongoDB"
By Christopher Buecheler.
And this example is no exception. Then why do people who want to learn this language very quickly have a need in it? Many of them have a reason and it is that they need to integrate quickly programs written in D with other services, programming languages and databases.

.. В качестве is a D pacakge for easily building fast, productive network applications.
The article "`Creating a simple restful web app with node.js, Express, and MongoDB <http://cwbuecheler.com/web/tutorials/2014/restful-web-app-node-express-mongodb/>`_" by Christopher Buecheler is taken as a basis for this example.

.. Далее представлена краткая инструкция

Initialization
^^^^^^^^^^^^^^^

Для создания скелета веб приложения запустите
To create a skeleton web application, run:

.. code-block:: shell
$ dub vibed-mongo vibe.d
Эта команда создаст minimal HTTP server based on vibe.d в папке ``vibed-mongo``.
This will make in directory ``vibed-mongo`` with a minimal HTTP server based on vibe.d.

Конфигурационный файл ``dub.json`` будет выглядеть примерно следующим образом
The configuration file ``dub.json`` will look something like this:

.. literalinclude:: ../../examples/vibed-mongo/dub.json
:language: json
:tab-width: 4

Версия ``"VibeDefaultMain"`` включает в проект функцию ``main`` определенную
по умолчанию.
The version ``"VibeDefaultMain"`` includes the main function defined by default.

Структура файлов ``vibed-mongo`` имеет следующую структуру:
The project has the following structure:


После установки MongoDB запустите его
After installing MongoDB run Mongo servers

.. code-block:: shell
$ mongod
В другой консоле выполнете
In another console run Mongo console

.. code-block:: shell
$ mongod
$ mongo
> use vibed
switched to db vibed
> db.createCollection("userlist", {autoIndexID : true})
Expand All @@ -156,13 +143,12 @@ Initialization
> exit
bye
Команда создаст базу данных ``vibed`` с коллекций ``userlist``,
в которой будет одна запись.
The script above will create a ``vibed`` database with a ``userlist`` collection, which will contain one record.
Patches
^^^^^^^^^
В сравнении с исходной статьей незначительно был измененен `global.js`:
Comparing with the original article ``global.js`` was slightly changed:
.. literalinclude:: ../../examples/vibed-mongo/public/javascripts/global.js
:language: js
Expand All @@ -180,8 +166,8 @@ Patches
Service
^^^^^^^^^^^^^
vibe.d является хорошим примером использования декларативного программирования на (with?) D.
Сервис реализует добавление в базу и удаление из базы записей о пользователях.
``vibe.d`` is a good example of the use of declarative programming with D.
Service performs an addition, select and remove operations for user entries at a MongoDB.
.. literalinclude:: ../../examples/vibed-mongo/source/service.d
:language: d
Expand All @@ -190,7 +176,7 @@ vibe.d является хорошим примером использовани
App
^^^^^^^^^^^^^
Осталось подключить MongoDB, инициализировать сервер и реализовать обработчик ошибок.
Following static constructor connects ``vebid`` MongoDB, creates vibe.d server and implements an error handler.
.. literalinclude:: ../../examples/vibed-mongo/source/app.d
:language: d
Expand Down
1 change: 0 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ NOT READY!
:maxdepth: 2

introduction
sdk
examples
integration
links
17 changes: 4 additions & 13 deletions docs/source/integration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,16 @@ NOT READY!
C and friends
-------------

D имеет полную поддержку C ABI (application binary interface)
недавно был значительно улучшен С++ ABI [#ABI]_
(одноко стоит заметить, что нет поддержки исключений).
Jacob Carlborg проделал огромнейшую работу по интеграции с Objective-C,
которая пока ожидает своего не менее грандиозного ревью от Walter Bright.
D that has full support for C ABI (application binary interface) had recently been significantly improved from C++ ABI [#ABI]_ (however it's worth noting that there is no support for exceptions). Jacob Carlborg did a great job of integrating with Objective-C, which is still waiting to be no less grandiose Review by Walter Bright.

Scripting languages
-------------------

С интеграцией со скриптовыми языками Вы уже немного знакомы на примере использования библиотеки matplotlib (python).
Так как большинство из них имеют C API [#API]_, то их интеграция с D может быть выполнена без
особых проблем.
You are already somehow familiar with the integration of scripting languages on the example of the use of the library matplotlib (python). Since most of them have a C API [#API]_, their integration with D can be performed without problems.

Имеется реалиазация the ECMA 262 (Javascript) programming language
написанная Walter Bright и обновленная Dmitry Olshansky.

Также стоит отметить про популярный в компьютерных играх скриптовой язык Lua. Unlike many other libraries built on the Lua C API, LuaD doesn't expose the Lua stack - instead, it has wrappers for references to Lua objects, and supports seamlessly and directly converting any D type into a Lua type and vice versa.
There is a realization of the ECMA 262 (Javascript) programming language written by Walter Bright and updated by Dmitry Olshansky.

It is also worth mentioning a popular computer games scripting language Lua. Unlike many other libraries built on the Lua C API, LuaD does not expose the Lua stack - instead, it has wrappers for references to Lua objects, and supports seamlessly and directly converting any D type into a Lua type and vice versa

.. [#API] Application Programming Interface
.. [#ABI] Application Binary Interface
5 changes: 4 additions & 1 deletion docs/source/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ The present documentation is submitted to the rapid introduction to D for those
If you decide to use the D language in your daily work, you should start immediately with the study of the `official page <http://dlang.org>`_ and of the book `"The D Programming Language" <http://erdani.com/index.php/books/tdpl/>`_ by Andrei Alexandrescu.

Probably D is the most powerful of the present `system programming languages <http://en.wikipedia.org/wiki/System_programming_language>`_.
It is a `dragon <http://thebird.nl/blog/D_Dragon.html>`_. Have a nice flight!

*D is a dragon* [#dragon]_. *Have a nice flight!*

.. [#dragon] `D is a dragon, or why D matters for Bioinformatics <http://thebird.nl/blog/D_Dragon.html>`_ by Pjotr Prins.
80 changes: 80 additions & 0 deletions docs/source/links.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,83 @@ Libraries and Frameworks

Articles
------------

Compilers
--------------

.. DMD
.. ~~~
.. DMD
.. LLVM D Compiler
.. ~~~~~~~~~~~~~~~~
.. LLVM
.. GNU D compiler
.. ~~~~~~~~~~~~~~~~
.. GDC
Build systems
--------------

.. Makefile
.. ~~~~~~~~
.. rdmd
.. ~~~~~~~~
.. dub
.. ~~~~~~~~
Development Environments
--------------

.. Sublime Text 3
.. ~~~~~~~~~~~~~~
.. Vim
.. ~~~~~~~~
.. Mono-D
.. ~~~~~~~~
.. Visual-D
.. ~~~~~~~~
.. DDT
.. ~~~~~~~
Documentation generators
-------------------------

.. Harbored mode
.. ~~~~~~~~~~~~~~~~
.. ddoc
.. ~~~~~~~~~~~~~~~~
.. ddox
.. ~~~~~~~~~~~~~~~~
Online tools
--------------
.. Testing & Debugging
.. -------------------
.. Travis CI
.. ~~~~~~~~~~~~~
.. Code coverage
.. --------------
.. Coveralls
.. ~~~~~~~~~~~~~
.. Interactive D Compiler and Disassembler
.. ----------------------------------------
84 changes: 0 additions & 84 deletions docs/source/sdk.rst

This file was deleted.

0 comments on commit 4ffeb4a

Please sign in to comment.