<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Lorenzo (Mec-iS)</title>
    <description>The latest articles on DEV Community by Lorenzo (Mec-iS) (@tuned).</description>
    <link>https://dev.to/tuned</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F148569%2Fbd88aab9-cee9-42f9-ba57-dbb0780367c7.png</url>
      <title>DEV Community: Lorenzo (Mec-iS)</title>
      <link>https://dev.to/tuned</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tuned"/>
    <language>en</language>
    <item>
      <title>ML in Rust: smartcore</title>
      <dc:creator>Lorenzo (Mec-iS)</dc:creator>
      <pubDate>Wed, 09 Nov 2022 23:28:53 +0000</pubDate>
      <link>https://dev.to/tuned/ml-in-rust-smartcore-55lg</link>
      <guid>https://dev.to/tuned/ml-in-rust-smartcore-55lg</guid>
      <description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;Today we have released &lt;a href="https://github.com/smartcorelib/smartcore"&gt;version 0.3 of &lt;strong&gt;smartcore&lt;/strong&gt;&lt;/a&gt;: a comprehensive library for machine learning and numerical computing. The library provides a set of tools for linear algebra, numerical computing, optimization, and enables a generic, powerful yet still efficient approach to machine learning.&lt;/p&gt;

&lt;p&gt;We provide an easy and familiar API for ML practitioners to have an entrypoint into Rust but also a compact implementation of most popular machine learning algorithms to work with environments running Wasm32 and Wasi.&lt;/p&gt;

&lt;p&gt;Easiest way to get the feeling are the &lt;a href="https://github.com/smartcorelib/smartcore-jupyter/tree/main/notebooks"&gt;Jupyter Notebooks&lt;/a&gt; but also the &lt;a href="https://docs.rs/smartcore/latest/smartcore/"&gt;documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Feel free to contribute or ask questions!&lt;br&gt;
Cheers,&lt;br&gt;
Lorenzo&lt;/p&gt;

</description>
      <category>rust</category>
      <category>machinelearning</category>
      <category>webassembly</category>
      <category>wasi</category>
    </item>
    <item>
      <title>Dagger and CUE, the new kids in the block</title>
      <dc:creator>Lorenzo (Mec-iS)</dc:creator>
      <pubDate>Wed, 27 Apr 2022 14:37:55 +0000</pubDate>
      <link>https://dev.to/tuned/dagger-and-cue-the-new-kids-in-the-block-1ehp</link>
      <guid>https://dev.to/tuned/dagger-and-cue-the-new-kids-in-the-block-1ehp</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;Some of the nice guys that gave Docker to the world have moved on into a new project for automating CI/CD called &lt;a href="https://dagger.io/"&gt;dagger.io&lt;/a&gt;: this new product starts from nice assumptions and all the experience from the previous project, absolutely interesting indeed. What we are going to peak here is the language at the base of Dagger: CUE, to which I have taken a peak recently.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is CUE
&lt;/h2&gt;

&lt;p&gt;From the &lt;a href="https://cuelang.org/"&gt;CUE language homepage&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;CUE is an open source language, with a rich set of APIs and tooling, for defining, generating, and validating all kinds of data: configuration, APIs, database schemas, code, … you name it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;CUE is a superset of JSON specializing in "Validate, define, and use dynamic and text-based data". This means that all the serialization fans can find this useful: JSON follower, YAML prayers, ProtoBuf believers can give it a try to the language and see what is can do to make more solid their configuration files.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install GO and CUE
&lt;/h2&gt;

&lt;p&gt;CUE is a CLI tool written in Golang and can be installed as a library for your Golang installation as &lt;a href="https://cuelang.org/docs/install/"&gt;stated in the minimal documentation&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# install as a library
$ go install cuelang.org/go/cmd/cue@latest
# install as CLI
$ git clone git@github.com:cue-lang/cue.git &amp;amp;&amp;amp; cd cue &amp;amp;&amp;amp; go get cuelang.org/go/cue
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(ensure that your $HOME/go/bin directory is in your path).&lt;/p&gt;

&lt;p&gt;Try your installation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cue --help
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The declarative power
&lt;/h2&gt;

&lt;p&gt;The main point of CUE is to provide powerful schema definition and serialization to different format via a declarative language, let's see an example with mixed data (string, numbers, collections):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// save this content to a namefile.cue file

// you can declare a generic structure to define your map 

nameyourmap: data: "point.json":{ x: 4.5, y: 2.34 }
nameyourmap: yaml_string: """
one: this_is_yaml
two: this_is_also_yaml
"""
nameyourmap:this_is_list: [1, 2, 3.5]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a generic CUE file that can be serialized into text formats:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# generate text file from code
$ cue export namefile.cue
{
    "nameyourmap": {
        "data": {
            "point.json": {
                "x": 4.5,
                "y": 2.34
            }
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cue export namefile.cue
{
    "nameyourmap": {
        "data": {
            "point.json": {
                "x": 4.5,
                "y": 2.34
            }
        },
        "yaml_string": "one: this_is_yaml\ntwo: this_is_also_yaml",
        "list": [
            1,
            2,
            3.5
        ]
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is already great as we can easily write scripts to create large configuration files, inject values or even entire files in the position where it is needed.&lt;br&gt;
We can also see three of the basic characteristics of CUE syntax:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;inline, easy to read&lt;/li&gt;
&lt;li&gt;multiple declarations add new fields&lt;/li&gt;
&lt;li&gt;fields cannot be accidentally over-written (try to add &lt;code&gt;nameyourmap:this_is_list: [1, 2, 3.5, 4.5]&lt;/code&gt; to the end of the file and you will see an error)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Marshal/Unmarshal formats
&lt;/h2&gt;

&lt;p&gt;In the previous example we had two critical points, at lines 4 and 5 we defined two structure for the fields &lt;code&gt;point.json&lt;/code&gt; and &lt;code&gt;yaml_string&lt;/code&gt;. How is it possible to have two different formats in the same declaration? That is one of the best feature up to now, as strings can be imported from different formats leveraging the right functions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// save this content to a test1.cue file

// you can declare a generic structure to define your map 

nameyourmap: data: "point.json":{ x: 4.5, y: 2.34 }
nameyourmap: yaml_structure: yaml.Unmarshal("""
one: this_is_yaml
two: this_is_also_yaml
""")
nameyourmap:this_is_list: [1, 2, 3.5]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's run the code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cue export test1.cue
{
    "nameyourmap": {
        "data": {
            "point.json": {
                "x": 4.5,
                "y": 2.34
            }
        },
        "yaml_structure": {   &amp;lt;&amp;lt;&amp;lt;
            "one": "this_is_yaml",
            "two": "this_is_also_yaml"
        },
        "this_is_list": [
            1,
            2,
            3.5
        ]
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see now the YAML field is not a string anymore but a map defined from the YAML string.&lt;/p&gt;

&lt;p&gt;That is all for now. CUE has other superpowers: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data Validation&lt;/li&gt;
&lt;li&gt;Schema Definition&lt;/li&gt;
&lt;li&gt;Code Generation and Extraction&lt;/li&gt;
&lt;li&gt;Querying&lt;/li&gt;
&lt;li&gt;Scripting&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can find some explanations in the &lt;a href="https://cuelang.org/docs/"&gt;documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Dagger is built on CUE to provide building CI/CD pipelines quickly and run them anywhere.&lt;/p&gt;

&lt;p&gt;If you liked this post please ❤️ and I will consider going on with this walk-through.&lt;/p&gt;

</description>
      <category>parsing</category>
      <category>validation</category>
      <category>devops</category>
      <category>cue</category>
    </item>
    <item>
      <title>A hidden realm new on Youtube</title>
      <dc:creator>Lorenzo (Mec-iS)</dc:creator>
      <pubDate>Sat, 01 May 2021 00:18:42 +0000</pubDate>
      <link>https://dev.to/tuned/a-hidden-realm-new-on-youtube-5g7c</link>
      <guid>https://dev.to/tuned/a-hidden-realm-new-on-youtube-5g7c</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--x-k5e4cH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/02c086dvjj1944z7kumn.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--x-k5e4cH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/02c086dvjj1944z7kumn.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have opened a Art&amp;amp;Science channel on Youtube in which I try to provide mini-experiences based on microscopy and data science. Level of geeking, off-the-counter.&lt;br&gt;
Read video's description to enter the realm.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://youtu.be/PczEN0HohaU"&gt;https://youtu.be/PczEN0HohaU&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Please subscribe and like if you want more.&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>biology</category>
      <category>python</category>
      <category>opencv</category>
    </item>
    <item>
      <title>An intuition pump: APIs as cognitive tool — Part 1</title>
      <dc:creator>Lorenzo (Mec-iS)</dc:creator>
      <pubDate>Fri, 17 Apr 2020 15:42:11 +0000</pubDate>
      <link>https://dev.to/tuned/an-intuition-pump-apis-as-cognitive-tool-part-1-2apb</link>
      <guid>https://dev.to/tuned/an-intuition-pump-apis-as-cognitive-tool-part-1-2apb</guid>
      <description>&lt;p&gt;For a proper background to enjoy this post take a look to these links about:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Intuition_pump"&gt;Intuition pump&lt;/a&gt;: for an overview about how philosophical tales and thought experiments are powerful tools for a productive and generative idea about&lt;/p&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Intentional_stance"&gt;intentional stance&lt;/a&gt; (briefly, the semantic layer with which we explain causal relations, the collections of meanings and their relations as result of cognitive processes and experiences).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://ase.tufts.edu/cogstud/dennett/papers/twoblackboxes.pdf"&gt;Two Black-Boxes experiment&lt;/a&gt; (Dennett, 2010), a thought experiment about two connected machines embedding the same contextualised knowledge of the world and how they can be reverse-engineered to result in collections of meanings (e.g. abstractions that enrich somebody’s intentional stance).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.hydraecosystem.org/"&gt;Hydra Ecosystem&lt;/a&gt;, a set of tools to design-deploy semantically linked Web APIs. In early development by myself and other contributors in this &lt;a href="https://github.com/HTTP-APIs"&gt;organisation&lt;/a&gt;. We will try in Part 2 to explain how a client-server system works in terms of the concepts built from the Two Black-Boxes Experiment.&lt;/p&gt;

&lt;p&gt;If you are quite confident of your understanding of what a Web API is, you can skip to paragraph II.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;I.&lt;/strong&gt; APIs (Application Programming Interfaces) are powerful layers between programs that allow “wiring” of different modules (maybe created by different contributors) with simple programmatic function calls. Integration of software is eased on by just calling functions and forgetting about the underlying implementation; APIs are like membranes with well-documented receptors, that accept some specific proteins and produce expected results. They are bridges over implementation intricacies: a program can ask for an operation and expect the right value to return, without knowing thing about the complexity required to compute the value. Every layer and module of a program is kept together by a multiplicity of APIs; those, at their simplest description, map a name to an operation. Call “ADD 1 3” to receive “4”, ADD is the name followed by inputs, usually what ADD is supposed to do is well documented so the outcome is an expected output ready to be immediatly used by the caller.&lt;/p&gt;

&lt;p&gt;Extending this concept to Web APIs using a &lt;strong&gt;Client-Server&lt;/strong&gt; paradigm implies having two different specialised systems that &lt;strong&gt;ask-answer&lt;/strong&gt; computational questions; the only difference is in the fact that the name to be called is a URL (not “ADD” but “example.com/add” ) and there are vastly complicated protocols to allow exhange of inputs and outputs (most of current usage of Web APIs sound more like, for example, “RETURN DATUM x FOR USER y” as, in particular, REST paradigm is about providing data and not about performing operations; for operations like “ADD x y” there are other paradigms that apply like RPC).&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;II.&lt;/strong&gt; A system that uses Web API is probably a geographically and semantically distributed artifact, it is the task of the developer that design programs to take advantage of a call to a faraway service. Hopefully these URIs and their inputs and outputs are well documented. This is obviously the foundation for Anything as a Service (I will avoid using an acronym here) as we know it. The developer, according to his/her &lt;em&gt;intentional stance&lt;/em&gt;, provides the context for creating a sequence of operations that become an effective process; in the larger picture, the process is part of a product and/or an endeavour.&lt;/p&gt;

&lt;p&gt;Leveraging Semantic Web technologies (see &lt;a href="https://en.wikipedia.org/wiki/Linked_data"&gt;Linked Data&lt;/a&gt;), developers try to add a layer of abstraction to their Web APIs to allow more powerful applications. In particular &lt;a href="https://www.hydra-cg.com/"&gt;W3C Hydra&lt;/a&gt; allows semantic annotations of Web APIs using Linked Data standards. What does it mean and how we can describe the level-up that these technologies allow? How the role of software and data exchange is improved by the addition of context (via meaning/semantics) to processes? How, if possible, can APIs be programmatic intuition pumps for software designers/developers in the scope of a particular domain?&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;III.&lt;/strong&gt; We can try to build a framework to answer the questions on the lines above by creating a parallel interpretation between the Client-Server system we created at Hydra Ecosystem and the ideal system as described by the Two Black-Boxes Experiment (TBBE); this allows to have a biunivocal perspective on what intuition pumps are, but also what Semantic Web APIs can achieve.&lt;/p&gt;

&lt;p&gt;Roughly (please take a glimpse to the linked paper), TBBE delivers a narration from the point of view of some rational investigators analyzing a system made up of two boxes (A and B) with completely hidden mechanism, that are connected by a cable. The first box has two buttons (alpha and beta), the second box has three bulbs (Red, Green and Amber). We can here finds out the initial affinity with APIs, both boxes are themselves (sub-)systems that are accessible via interfaces: the investogators can use the buttons (interface) in box A, box A can use the cable to send a signal to box B, box B returns a value via the bulbs (their interfaces are highly non-uniform, very bad non-standard situation; exactly the opposite of a well-designed software).&lt;/p&gt;

&lt;p&gt;Investigators and boxes are all parts of a client-server system in which the machinery of each part is completely inscrutable to the other (a very badly documented set of APIs). Moving on with the investigation it appears evident that the system has a very basic behaviour: pressing alpha triggers the light R on, pressing beta triggers the light G on, light A seems never triggered. These seem, tought, a very limited set of experiments and the lack of documentation does not allow to know the functioning of the single parts.&lt;/p&gt;

&lt;p&gt;The investigators move on into disassembling each part. Briefly, all the details in the paper, they find out each box is a very evoluted expert system; each expert system has been created by engineers with quite different backgrounds, but both rely on the same assessments over some true/false statements about some contextualised knowledge. Eventually what the full system is doing in reality: box A was stating a truth (button alpha) or a falsehood (button beta) and box B was confirming a truth (bulb R) or a falsehood (bulb G) or a malformed statement (bulb A). The correlation between buttons and bulbs was not the result of a direct wiring of circuits but, instead, the “agreement” about some statements based on the common reality that the two engineers share of the “world”. The TBBE is full of nuances about how the investigation is carried on and it is very intriguing in establishing boundaries about what is known and what this knowledge implies. I leave to reading further discoveries.&lt;/p&gt;

&lt;p&gt;My take on this great thought experiment: TBBE is, generically, about analytically tackling the behaviour (&lt;em&gt;syntactic engine&lt;/em&gt;) of a system and trying to establish an &lt;em&gt;intentional stance&lt;/em&gt; in the mind of an investigator. A &lt;em&gt;syntactic engine&lt;/em&gt; is the manifestation of patterns (simply, the observed behaviour) of a system (i.e. a non-random sequence of 0 or 1, a sequence of characters, etc.); the investigators do not accept the first superficial obervation of patterns, they decide to go with finding out the real flow of information between the boxes by opening them, and they discover a very high complexity in data and encoding. Initially their map of meaning (stance) is very limited and the syntatic engine they witness is so simple that it doesn’t really deserve explanation (one button, one bulb); but, as the investigation goes on and data and patterns start to be highly explanatory of a complex behaviour, their stance evolves to mirror what they observe to be an two-component expert system and all the meanings that the components embed (the shared “world” of the engineers that far away from each other created the two black boxes).&lt;/p&gt;

&lt;p&gt;Every cognitive process tries to observe something that intially looks gibberish (highly probable, noise) by analysing recurrences of patterns (highly improbable) to assign relations into maps of meanings (&lt;a href="https://en.wikipedia.org/wiki/Predictive_coding"&gt;Predictive Coding&lt;/a&gt; tries to explain in more detail this concurrent bottom-up and top-down process of adjusted predictions between “syntactic engines” produced by senso-motorial data and high-level representation). What we are initially observing is a &lt;em&gt;syntactic engine&lt;/em&gt; made of data streams, there is no “cognition happening” in there and our initial stance is confused. As much the analytical processing goes on the stance improves, and we can better “make sense” of the data.&lt;/p&gt;

&lt;p&gt;As we can imagine using a clean and well-documented API is the a great way of entering a specific domain. If you are developing software for any purpose or starting from a specialised background, APIs are gateways to cross-domain awareness; they are great tools of organising knowledge so by consequence to learn principles and make users more familiar with specific domains. Are APIs programmatic intuition generators? Maybe not, but I like the idea of looking at APIs as a valuable entrypoint to many scientific domains.&lt;/p&gt;

&lt;p&gt;On the cognitive side, this experiment can be interpreted as a good hint for the strict relationship between meaning and context. Intelligence (information) emerges from data and patterns (from a &lt;em&gt;syntactic engine&lt;/em&gt;); assigning meanings to patterns is the domain of a stance, these meanings once “discovered” are strictly bound to a context (the network of relations in which meanings are defined). The &lt;em&gt;intentional stance&lt;/em&gt; “store” meanings and relations among those meanings (context); generation of contextualised meanings is a big part of our cognitive activities. In the domain of software engineering, the best way for delivering meanings is to work with clean and well-documented APIs.&lt;/p&gt;

&lt;p&gt;Intuition pumps are well-established thinking tools in Philosophy. Is it possible to use APIs functions as building blocks to construct inutition pumps for specific domain. e.g. Which level of understanding of mathematics does reading a math library’s API provides? Does a software engineer mind represent intentionality in terms of APIs? Is this useful to acquire actual knowledge of the domain?&lt;br&gt;
These questions are important as is vital to understand how we experience knowledge and learn that is the field of Cognitive Sciences.&lt;/p&gt;




&lt;p&gt;If you are an API designer/developer and you want to know more how these concepts describe the tools developed at &lt;a href="https://www.hydraecosystem.org/"&gt;Hydra Ecosystem&lt;/a&gt; (also, for &lt;a href="https://opencollective.com/hydra-ecosystem"&gt;donations&lt;/a&gt;), please proceed &lt;a href="https://medium.com/@lorenzogotuned/an-intuition-pump-apis-as-cognitive-tool-part-2-6789f027da79"&gt;to Part 2&lt;/a&gt; of this blogpost.&lt;/p&gt;

&lt;p&gt;Ford on in this world of Interfaces!&lt;/p&gt;

</description>
      <category>webapis</category>
      <category>api</category>
      <category>cognitivesciences</category>
      <category>philosophy</category>
    </item>
    <item>
      <title>Memory views: Handling strings</title>
      <dc:creator>Lorenzo (Mec-iS)</dc:creator>
      <pubDate>Mon, 26 Aug 2019 15:12:22 +0000</pubDate>
      <link>https://dev.to/tuned/memory-views-handling-strings-48h7</link>
      <guid>https://dev.to/tuned/memory-views-handling-strings-48h7</guid>
      <description>&lt;p&gt;Brace yourself as this post is going to be a little less straightforward than the last ones as we are going to talk about how to read/write UTF-8 strings from/to WebAssembly (Wasm) memory views!&lt;/p&gt;

&lt;h1&gt;
  
  
  Unicode (a resume)
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;feel free to skip to the next paragraph if you think you are already familiar with&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Even if Rust-compiled Wasm and Python are very different languages in many points, they are probably at the opposite of the spectrum for the most popular programming languages, they both take advantage of &lt;a href="https://tools.ietf.org/html/rfc5198"&gt;&lt;strong&gt;Unicode&lt;/strong&gt; Format for Network Interchange&lt;/a&gt;; fortunately nowadays an accepted and well-supported standard.&lt;/p&gt;

&lt;p&gt;Some basic generics about Unicode:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;... it encodes a character as a sequence of one to four bytes [1]&lt;/p&gt;

&lt;p&gt;... only the shortest encoding for any given code point is considered well-formed; you can’t spend four bytes encoding a code point that would fit in three [1]&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Every group of code points (for UTF-8, a code point can be as small as 1 byte, up to 4) in the string encodes a character (in other words UTF-8 is an 8-bit variable width encoding for Unicode); usually there is a base code point plus code points afterwards that add details to the base. &lt;a href="https://en.wikipedia.org/wiki/Unicode#Versions"&gt;Unicode version 12.1&lt;/a&gt; allows the recording of 137,994 code points that covers all characters for a large amount of languages.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;UTF-8 supports any Unicode character, which pragmatically means any natural language (Coptic, Sinhala, Phonecian, Cherokee etc), as well as many non-spoken languages (Music notation, mathematical symbols, APL) and emoticons &lt;a href="https://superuser.com/a/946614"&gt;[source]&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;More information about this wonderful Internet-omnipresent tool at &lt;a href="https://home.unicode.org/basic-info/faq/"&gt;Unicode Consortium&lt;/a&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Strings
&lt;/h1&gt;

&lt;p&gt;What we need to know for this experiment is that we can represent strings of characters as lists of 8-bit integers that stand for Unicode (or group of) code points. To pass strings from/to Python and Wasm using &lt;a href="http://wasmer.io"&gt;&lt;em&gt;python-ext-wasmer&lt;/em&gt;&lt;/a&gt; we need to know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In Python strings are &lt;strong&gt;immutable sequences of characters&lt;/strong&gt;; open the Python IDLE and try:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# a Unicode string containing non-ASCII chars
&amp;gt;&amp;gt;&amp;gt; st = 'ABW@☀CC☯'

# same string as bytestring encoded in UTF-8 (hex)
&amp;gt;&amp;gt;&amp;gt; bytes(st, 'UTF-8')
b'ABS@\xe2\x98\x80CC\xe2\x98\xaf'

# UTF-8 (decimal) represention of the same bytestring
&amp;gt;&amp;gt;&amp;gt; [b for b in bytes(st, 'UTF-8')]
# elements for Unicode code points as Python integers
[65, 66, 83, 64, 226, 152, 128, 67, 67, 226, 152, 175]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;a href="https://graphemica.com/%E2%98%80"&gt;black sun with rays (U+2600)&lt;/a&gt; code point is represented in UTF-8 encoding with: 3 hexadecimal values or equivalently 3 positive decimal values:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#
# same code point, same encoding (different formats)
#
\xe2\x98\x80 ----&amp;gt; ☀ as UTF-8 (hex)
226 152 128 ----&amp;gt; ☀ as UTF-8 (decimal)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Any sequence of Unicode points can be represented as &lt;code&gt;List[int]&lt;/code&gt; in Python; in the particular case, if we want to use UTF-8 to inter-operate with code in Rust we need to use on its side a &lt;code&gt;Vec&amp;lt;u8&amp;gt;&lt;/code&gt; (more details &lt;a href="https://www.reddit.com/r/rust/comments/2b08l5/uft8_and_string_why_vecu8/"&gt;here&lt;/a&gt;); finally at Wasm-level we have a linear memory array of cells that index its elements:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# pseudo-code
array_memory[0] = 226
array_memory[1] = 152
array_memory[2] = 128
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is now evident how we can store the decimal UTF-8 points in Wasm linear memory.&lt;/p&gt;

&lt;h1&gt;
  
  
  Wasmer memory views
&lt;/h1&gt;

&lt;p&gt;We can think at every Wasm Instance as a mini-sandbox with its own abstractions over memory. Memory is represented as "views", basically tables that manage references between values and their position in linear memory.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Details&lt;/em&gt;: &lt;a href="https://github.com/wasmerio/wasmer/tree/dac86eec330b67cc60c81aa5640c3e4d66e901d2/lib/runtime-core/src"&gt;Wasmer runtime core&lt;/a&gt; provides these very powerful abstractions that allow to leverage Wasm memory; in this case we want to take a look to &lt;a href="https://github.com/wasmerio/python-ext-wasm/blob/f91ce2c32e6cf3b96cd858fbdaf40ab0e31b1c4c/src/memory/view.rs#L12"&gt;&lt;strong&gt;python-ext-wasm&lt;/strong&gt; Memory Views&lt;/a&gt;; the interface methods are generated from a macro for every primitive type. &lt;/p&gt;

&lt;h1&gt;
  
  
  Passing a string
&lt;/h1&gt;

&lt;p&gt;Let's enter the main part of the experiment: &lt;strong&gt;how can we use all these powerful tools to make Python talk fluently to Rust/Wasm&lt;/strong&gt; and receive back?&lt;br&gt;
Briefly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;we are going to tell from Python what to write to Instance's memory using Wasmer views&lt;/li&gt;
&lt;li&gt;we are going to call a Wasm function (compiled from Rust) reading from Instance's exported functions&lt;/li&gt;
&lt;li&gt;we are going to pass the result back to Python&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All this process is demonstrated by &lt;a href="https://github.com/Mec-iS/rust-wasm-python-101/blob/50ae7799bb0eeb725a5792dd1e83d258b70e21ae/pywasm/examples/__init__.py#L46"&gt;this function&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def test_reverse(instance, func, bytestr):

    # return a Wasmer Memory View for 8-bit integers
    mem_view = allocate_bytes(instance)

    # write the UTF-8 (decimal) code points to the view
    mem_view = write_to_memory(bytestr, mem_view, offset=0)

    # call the exported function by reading the offset of the
    # view for the length of the bytes string (b'...')
    result = func(0, len(bytestr))

    # read the result value at a given position in linear memory
    return address_to_utf8(mem_view, result, len(bytestr))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The methods used are loaded from this &lt;a href="https://github.com/Mec-iS/rust-wasm-python-101/blob/50ae7799bb0eeb725a5792dd1e83d258b70e21ae/pywasm/src/utils.py#L1"&gt;mini Python-to-Wasmer API&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The result is easily showed by this &lt;a href="https://github.com/Mec-iS/rust-wasm-python-101/blob/50ae7799bb0eeb725a5792dd1e83d258b70e21ae/pywasm/run_wasm_with_python.py#L31"&gt;chunk of code&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Reversing b'Test sTRing' &amp;gt;&amp;gt;&amp;gt;
b'gniRTs tseT'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thanks for your attention.&lt;/p&gt;

&lt;p&gt;Sources:&lt;br&gt;
[1] O'Relly "Programming Rust" ISBN-10: 9781491927281, pg. 392-393&lt;br&gt;
[2] &lt;a href="http://kunststube.net/encoding/"&gt;kunststube.net/encoding&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>rust</category>
      <category>webassembly</category>
      <category>wasmer</category>
    </item>
    <item>
      <title>Rust-scales Python: Flask Experiment</title>
      <dc:creator>Lorenzo (Mec-iS)</dc:creator>
      <pubDate>Wed, 31 Jul 2019 17:33:34 +0000</pubDate>
      <link>https://dev.to/tuned/rust-scales-python-flask-experiment-4l4l</link>
      <guid>https://dev.to/tuned/rust-scales-python-flask-experiment-4l4l</guid>
      <description>&lt;p&gt;Going on with this series of brief demos about how to embed Wasmer binaries into Python modules via &lt;code&gt;python-ext-wasmer&lt;/code&gt; (see previous episodes &lt;a href="https://dev.to/tuned/rust-scales-python-basic-experiment-49h0"&gt;1&lt;/a&gt; and &lt;a href="https://dev.to/tuned/rust-scales-python-some-examples-1-2dj5"&gt;2&lt;/a&gt;). &lt;/p&gt;

&lt;p&gt;I wondered what it would look like a Web application that leverages Wasm binaries; let's use &lt;a href="https://palletsprojects.com/p/flask/"&gt;Flask micro-framework&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;We start the usual way, using the previously compiled Rust functions. For this experiment we pick:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The two versions of Fibonacci, one as Python function, the other as Wasm-compiled Rust; &lt;/li&gt;
&lt;li&gt;The two versions for a static computation of Convex Hull.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This time we &lt;a href="https://github.com/Mec-iS/rust-wasm-python-101/blob/0ad1a42f637d505bac8cf02e594be122900ec2c2/pywasm/examples/flask_basic/__init__.py#L9"&gt;wrap the pre-compiled binaries into a Flask app&lt;/a&gt; and serve them through two endpoints:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/Mec-iS/rust-wasm-python-101/blob/0ad1a42f637d505bac8cf02e594be122900ec2c2/pywasm/examples/flask_basic/app.py#L8"&gt;&lt;code&gt;fibo_wasm&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/Mec-iS/rust-wasm-python-101/blob/0ad1a42f637d505bac8cf02e594be122900ec2c2/pywasm/examples/flask_basic/app.py#L50"&gt;&lt;code&gt;convexhull_wasm&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As you can see, the loading of the binaries is practically at no-cost in terms of service performance as it is done at app creation. This allows to load as much binaries as we need to perform the processing via the endpoints. It could possibly be a good solution for a RPC API that accepts arbitrary parameters.&lt;/p&gt;

&lt;p&gt;Let's try to run it:&lt;/p&gt;

&lt;p&gt;[UPDATED]&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;platform linux -- Python 3.6.8, pytest-4.4.1, py-1.8.0, pluggy-0.9.0
rootdir: /home/mec-is/rustcode/wasm-python-101
collected 4 items                                                                                 

pywasm/examples/flask_basic/tests.py 2019-08-18 16:17.29 Time it                        func=fibo_wasm time=0.07568788528442383
.2019-08-18 16:17.35 Time it                        func=fibo_py time=0.06508588790893555
.2019-08-18 16:17.41 Time it                        func=convexhull_wasm time=0.10294783115386963
.2019-08-18 16:17.48 Time it                        func=convexhull_py time=0.4820021390914917

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Not bad for a first run!&lt;/p&gt;

</description>
      <category>webassembly</category>
      <category>python</category>
      <category>rust</category>
    </item>
    <item>
      <title>Rust-scales Python: Some examples (1)</title>
      <dc:creator>Lorenzo (Mec-iS)</dc:creator>
      <pubDate>Sun, 07 Jul 2019 16:38:30 +0000</pubDate>
      <link>https://dev.to/tuned/rust-scales-python-some-examples-1-2dj5</link>
      <guid>https://dev.to/tuned/rust-scales-python-some-examples-1-2dj5</guid>
      <description>&lt;p&gt;Please read the &lt;a href="https://dev.to/tuned/rust-scales-python-basic-experiment-49h0"&gt;first part of this post&lt;/a&gt; before going on with this one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In the &lt;a href="https://dev.to/tuned/rust-scales-python-basic-experiment-49h0"&gt;first post of this series&lt;/a&gt; I displayed the basic commands needed to leverage &lt;a href="https://github.com/wasmerio/python-ext-wasm/tree/master"&gt;python-ext-wasm&lt;/a&gt;. Wasmer.io is a project aiming to provide a streamlined solution to allow compilation and usage of "Universal Binaries" via WebAssembly; &lt;strong&gt;python-ext-wasm&lt;/strong&gt; is a library that provides binding from Python to compiled binaries so that in future any Python developer can take advantage of all the incredible WebAssembly features by keeping writing Python code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Environment and assumptions
&lt;/h2&gt;

&lt;p&gt;As described in the previous post we work with a diverse setup without leaving behind ergonomics and ease-of-use. The basics components for starting experimenting are Rust (and &lt;code&gt;cargo&lt;/code&gt;) and Python. I have spotted some functions that are going to be our targets for the sake of exercise with the workflow and also provide some basic measures of how useful the Wasmer.io approach is and will be. These functions are written in Rust:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;a simple addition function:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;pub&lt;/span&gt; &lt;span class="k"&gt;extern&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;simple_add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;i32&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;i32&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;i32&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;a Fibonacci series implementation, one of the many you may have used while trying to exercise your coding skills (&lt;a href="https://github.com/eliovir/rust-examples/blob/master/fibonacci.rs"&gt;credits here&lt;/a&gt;):&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="nd"&gt;#[no_mangle]&lt;/span&gt;
&lt;span class="k"&gt;pub&lt;/span&gt; &lt;span class="k"&gt;extern&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;fibo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;i32&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;i32&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nd"&gt;panic!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"{} is negative!"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nd"&gt;panic!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"zero is not a right argument to fibonacci()!"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="k"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="k"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="k"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;curr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="mi"&gt;_&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;..&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;curr&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;last&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;curr&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;curr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;sum&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The function used to compute &lt;a href="https://en.wikipedia.org/wiki/Convex_hull"&gt;Convex Hull&lt;/a&gt; over a set of Cartesian points, as taken from Rust &lt;a href="https://github.com/georust/geo"&gt;geo&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nn"&gt;geo&lt;/span&gt;&lt;span class="p"&gt;::{&lt;/span&gt;&lt;span class="n"&gt;Polygon&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;LineString&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nn"&gt;geo&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;convexhull&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;ConvexHull&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c"&gt;///&lt;/span&gt;
&lt;span class="c"&gt;/// Constructive operations: Convex hull in Rust Geo&lt;/span&gt;
&lt;span class="c"&gt;///&lt;/span&gt;
&lt;span class="nd"&gt;#[no_mangle]&lt;/span&gt;
&lt;span class="k"&gt;pub&lt;/span&gt; &lt;span class="k"&gt;extern&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;rust_geo_convex_hull&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="c"&gt;// An L shape&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;coords&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nd"&gt;vec!&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;4.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;4.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;4.0&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;4.0&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;)];&lt;/span&gt;
&lt;span class="c"&gt;// conversions to geo types are provided from several kinds of coordinate sequences&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;poly&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;Polygon&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;coords&lt;/span&gt;&lt;span class="nf"&gt;.into&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="nd"&gt;vec!&lt;/span&gt;&lt;span class="p"&gt;[]);&lt;/span&gt;

&lt;span class="c"&gt;// uses the QuickHull algorithm to calculate the polygon's convex hull&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;hull&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;poly&lt;/span&gt;&lt;span class="nf"&gt;.convex_hull&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I picked these functions so that is possible to compare them with their own functionally equivalent counterparts in Python that you can &lt;a href="https://github.com/Mec-iS/rust-wasm-python-101/blob/master/timing/src_py/__init__.py"&gt;find coded here&lt;/a&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;the most basic addition function in Python&lt;/li&gt;
&lt;li&gt;a Fibonacci implementation taken from SO that uses a while loop (as the Rust implementation above using a for-loop)&lt;/li&gt;
&lt;li&gt;the Convex Hull implementation as provided by &lt;a href="https://pypi.org/project/Shapely/"&gt;&lt;code&gt;shapely&lt;/code&gt;, one of the most popular Python geolibrary&lt;/a&gt; (&lt;code&gt;pip install shapely[vectorized]&lt;/code&gt;). The same input has been passed as in its Rust counterpart.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Running the tests
&lt;/h2&gt;

&lt;p&gt;If you have already your Python virtual environment up with the requirements installed, and you follow the simple instructions in the previous post, you may be able to &lt;a href="https://github.com/Mec-iS/rust-wasm-python-101"&gt;clone the repo&lt;/a&gt; and try on your own:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;in the root directory, do your &lt;code&gt;cargo build --target wasm32-unknown-unknown&lt;/code&gt; to compile your universal binary with the Rust functions above;&lt;/li&gt;
&lt;li&gt;in &lt;code&gt;timing&lt;/code&gt; directory run &lt;code&gt;python run_timing_collection.py&lt;/code&gt;. This is a series of &lt;code&gt;timeit&lt;/code&gt; calls that time both implementations for each function&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the outcome as printed by my machine listing the Python function timing and the Wasm function timing over some thousands of iterations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Modules exported from Rust: 
&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"loop_str"&lt;/span&gt;, &lt;span class="s2"&gt;"rust_geo_convex_hull"&lt;/span&gt;, &lt;span class="s2"&gt;"fibo"&lt;/span&gt;, &lt;span class="s2"&gt;"simple_add"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
py add 1.2614150420049555
t_wasm add 8.43558448299882
py fibo 44.35585713999899
t_wasm fibo 1.240821371000493
py shapely convex hull 47.863506109999435
t_wasm rust-geo convex hull 2.2532036840057117
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should also find some data in &lt;code&gt;timing/data/timing.csv&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Disclaimer&lt;/em&gt;: I do not assume that this is a proper benchmark but more an exercise, so I do not expect the results to be accurate but only to give a general indication of trends.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I would be glad to receive more data from different setups. If you want you can just drop a comment with the results printed out by your machine; just copy/paste the last line in your &lt;code&gt;timing.csv&lt;/code&gt; to help with some data.&lt;/p&gt;

&lt;p&gt;Thanks to all the OpenSource maintainers that made this short experiment possible.&lt;/p&gt;

</description>
      <category>rust</category>
      <category>webassembly</category>
      <category>python</category>
    </item>
    <item>
      <title>Rust-scales Python: Basic Experiment</title>
      <dc:creator>Lorenzo (Mec-iS)</dc:creator>
      <pubDate>Thu, 18 Apr 2019 19:33:31 +0000</pubDate>
      <link>https://dev.to/tuned/rust-scales-python-basic-experiment-49h0</link>
      <guid>https://dev.to/tuned/rust-scales-python-basic-experiment-49h0</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fqpvdvmwlck64foz2lgb2.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fqpvdvmwlck64foz2lgb2.jpg" alt="pic by https://twitter.com/MittermeierFlx"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Some bits
&lt;/h2&gt;

&lt;p&gt;Python bindings from/to C and C++ are probably one of the hottest topic for an intermediate/advanced Python engineer trying to get some handle on profiling and optimisation, and the inner capabilities of Python’s Virtual Machine. These low-level system languages are probably the fellows to walk with towards understanding of Python’s stack and the wider &lt;em&gt;C-family of language&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;The latest most notable addition to this family is probably &lt;a href="https://en.wikipedia.org/wiki/Rust_%28programming_language%29" rel="noopener noreferrer"&gt;Rust, a Mozilla-backed language that provides a stable API since 2015&lt;/a&gt;: there is a lot of enthusiasm around its adoption and in this article I try an experiment that may suggest one reason for; beside the many other advantages you can already read about in &lt;a href="https://medium.com/search?q=rustlang" rel="noopener noreferrer"&gt;many other articles around&lt;/a&gt;. Main reasons I find motivating to learn Rust are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;it is &lt;strong&gt;multi-paradigm by design&lt;/strong&gt;:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(C-like structures but also Functional tools beside Static-typing and more) the most popular languages around are designed taking one paradigm as reference, and have tried to cope by adding support for other paradigms via additions to the respective standard libraries. This unfortunately ends up in a mix that makes a lot of engineers unsatisfied; the outcome of a single-paradigm design are usually limitations in possibilities of expression.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;it is designed considering &lt;strong&gt;user-experience&lt;/strong&gt; for the entire workflow/life-cycle:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(from installation to release, through testing, documentation, packages managing) most of the languages have grown in their core capabilities before reaching the critical mass to justify the development of automation/productivity tools; this realised into gaps, conflicts and quality differences between tools used at different steps of the developing experience.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;it provides the best level of integration with &lt;a href="https://en.wikipedia.org/wiki/WebAssembly" rel="noopener noreferrer"&gt;WebAssembly (Wasm)&lt;/a&gt; at the moment and possibly in perspective:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;WebAssembly has reached a stable interface and it is now a standard; it will be the platform on-top of which Web software is going to be built. Rust provides straightforward access to Wasm, as simple as we are going to show in this experiment.&lt;/p&gt;

&lt;p&gt;Let’s see how simple it is to start a project, create a function in Rust, compile the library in WebAssembly and finally call this function from Python (yea! no work on C-bindings with all the memory-safety pitfalls and compiling flags! Python will call native WASM modules).&lt;/p&gt;

&lt;h2&gt;
  
  
  Simple that matters
&lt;/h2&gt;

&lt;p&gt;You can try this kind of experiment by installing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://rustup.rs/" rel="noopener noreferrer"&gt;&lt;em&gt;rustup&lt;/em&gt;&lt;/a&gt;: tool-chains manager to navigate the manifold of Rust’s ecosystem&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;cargo&lt;/em&gt;: the package manager&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;rustc&lt;/em&gt;: the Compiler, working along with the rest of a stable Rust toolchain for your machine.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;rustup&lt;/em&gt; install all of that for you!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let’s start:&lt;/p&gt;

&lt;p&gt;.1. Add the Wasm tool-chain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; rustup target add wasm32-unknown-unknown
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.2. Create a new project and change directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cargo new medium-xp &amp;amp;&amp;amp; cd medium-xp 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.3. Create a &lt;code&gt;lib.rs&lt;/code&gt; file in &lt;code&gt;src&lt;/code&gt; directory. All code goes in &lt;code&gt;src&lt;/code&gt;, &lt;code&gt;lib.rs&lt;/code&gt; is where Rust keep the root library code.&lt;/p&gt;

&lt;p&gt;.4. &lt;code&gt;Cargo.toml&lt;/code&gt; is your package configuration file, add this section to the &lt;code&gt;Cargo.toml&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[lib]
crate-type = [“cdylib”]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is to define the project as a dynamic library&lt;/p&gt;

&lt;p&gt;.5. &lt;code&gt;main.rs&lt;/code&gt; is your entry-point module, we are not going to use it this time as we are creating a library, not a binary. In &lt;code&gt;lib.rs&lt;/code&gt; add this code for our function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#[no_mangle]
pub extern fn simple_add(a: i32, b: i32) -&amp;gt; i32 { a + b}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.6. Compile the library for Wasm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cargo build --release --target wasm32-unknown-unknown
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you will find your library in &lt;code&gt;target/wasm32-unknown-unknown/release&lt;/code&gt; compiled as WASM module!&lt;/p&gt;

&lt;p&gt;.7. On the Python side:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;install &lt;a href="https://github.com/wasmerio" rel="noopener noreferrer"&gt;&lt;strong&gt;wasmer&lt;/strong&gt;&lt;/a&gt; extension for Python (tested on Python 3.6):
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; python3.6 -m pip install wasmer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;create a &lt;code&gt;run-wasm-from-python.py&lt;/code&gt; file with this script:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from wasmer import Instance
path = '&amp;lt;relative path to your Wasm file&amp;gt;'
with open(path, ‘rb’) as bytecode:
    wasm_bytes = bytecode.read()
    instance = Instance(wasm_bytes)
    result = instance.exports.simple_add(12, 12)
    print('Modules exported from Rust: ')
    print(instance.exports)  # this will print function's name
    print('call simple_add(12, 12): ')
    print(result)  # 24
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;run this script with: &lt;code&gt;python3.6 run-wasm-from-python.py&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you have done everything correctly…&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Modules exported from Rust: 
["simple_add"]
call simple_add(12, 12): 
24
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This demonstrates how it is technically possible to make &lt;strong&gt;Python inter-operating with compiled Rust using Wasm&lt;/strong&gt;. It is incredibly straightforward thanks to the powerful design of Rust and the incredible work done at every step of the tool-chain. As you could see everything runs smoothly with high-levels of productivity involved. I leave to You the considerations about advantages and disadvantages of trying to optimise heavy loads of computing with Rust while keeping the dynamic approach of Python at the higher level. This was possible only recently as all the interfaces and tools involved have stabilised, thanks to the great work done by Open Source developers all over the World.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Full repository &lt;a href="https://github.com/Mec-iS/rust-wasm-python-101" rel="noopener noreferrer"&gt;on Github&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Definitely check out &lt;a href="https://amp-reddit-com.cdn.ampproject.org/c/s/amp.reddit.com/r/rust/comments/9t95fd/howto_setting_up_webassembly_on_stable_rust/" rel="noopener noreferrer"&gt;this Reddit&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://wasmer.io" rel="noopener noreferrer"&gt;Wasmer here&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  In the same series
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;New Episode ---&amp;gt; &lt;a href="https://dev.to/tuned/rust-scales-python-some-examples-1-2dj5"&gt;some-examples-1&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;New episode ---&amp;gt; &lt;a href="https://dev.to/tuned/rust-scales-python-flask-experiment-4l4l"&gt;Flask-experiment&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>rust</category>
      <category>webassembly</category>
      <category>python</category>
    </item>
    <item>
      <title>Personal History Of Computing</title>
      <dc:creator>Lorenzo (Mec-iS)</dc:creator>
      <pubDate>Sun, 14 Apr 2019 17:18:45 +0000</pubDate>
      <link>https://dev.to/tuned/personal-history-of-computing-gh6</link>
      <guid>https://dev.to/tuned/personal-history-of-computing-gh6</guid>
      <description>&lt;h3&gt;
  
  
  Philosophical foundations for digital programming
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZKeJKftd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/5iow03lvc2v1s3z7jjhc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZKeJKftd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/5iow03lvc2v1s3z7jjhc.png" alt="linked network"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Some Introductory words
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;p&gt;"After the tool, responding only to his hand; after the machines, covering complex tasks and operations but subject to his will; here he is to delegate automata to take care of managing and thinking in place of himself, on the basis of apparently rational criteria.“ — H.J. Martin, 1988&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h4&gt;
  
  
  I — On contemporary society
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;p&gt;“If you want peace, prepare to set yourself free”&lt;br&gt;
“Si vis pacem para remissionem”&lt;br&gt;
“Se vuoi la pace, prepara la liberazione” — A. Capitini&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As young reckless troglodytes, in this new Neolithic of competences, we struggle searching for a feeble fire, donated by some other superior ancestors. They are together with a kind of a new machine­-mind demiurgos (crafter): Information [1]. Total immersion into media tracks our decisions; three centuries after political individualism single action reaches critic quantity leveraging electronics. The flames of valuable minorities (like myself or any other individual) can reach people, and be carried on. We are again fording on, carrying weak flames on thin branches from camp to camp, struggling to remember, to have a clear representation of human cognition.&lt;/p&gt;

&lt;p&gt;This constant intellectual (Latin — inter+lego: collect, gather [2]) process, of camping and leaving from/to representations or from/to frameworks, typical of digitally-high-exposed jobs (communication jobs, finance, coding, programming,engineering, automation ...)  proposes new tones of colours for a “nomadic” approach to frameworks and “theories”. Mostly because immobility can spot up dogmatism and because obsolescence is an almost omnipresent threat: to avoid which, we try to build tools to put up this logical &lt;em&gt;‘architrave’&lt;/em&gt; (a cornerstone for our Archive?[11] )[3], that is for sure a mathematical, physical, algorithmic and, finally, complex tool. Let’s iterate and see what can we say by defining the words “theories” “systems” and “frameworks” in the context of highly interconnected digital networks. This can help in building a caliper to fairly measure reality with the right amount of subjectivity: an Existentialism for Computability (what we are going to define as being-search). What are the strings pulled on logical thinking and the Self by knowledge networks (networks of digital media)? We would like to argument that is the cybernetic yoking of digital networks themselves, with their new languages, artificial or natural. We draw shapes for these structures leveraging, among others, the concept of authenticity, finalised to highlight individual possibilities inside the networks that provide shape translate Information.&lt;/p&gt;

&lt;p&gt;Let’s take this starting datum: for every frame into the monitor of a nowadays computer (1920x1080 pixels) we capture the same amount of Information transmitted in months by the whole of the telegraphic network in its early times (1920x1080x32 bits can contain approximately 1,300,000 messages). This unit of measure (bit) has both logical foundation, as measure of a decision-searching process, and physical, as expression of a set of signals on a wire (the first assumption is evident if considering how telephone numbers could address a receiver in early age of telephone). As we are, accustomed to the tools of natural language-based (socio-economical) background, we face, hidden, issues processing masses of digital information. Some general misconceptions of the tooling required is a missing &lt;em&gt;epistemological update&lt;/em&gt;; fortunately new theories and frameworks come to the rescue, they are just hard to find, and to carry on the struggle to update them consistently. We are drifting from the lack of knowledge source to the over-abundance of them. This implies a constant adjustment of our filtering abilities inside “frameworks” with the aim of understanding The Medium, the Internet. As a race driver is conscious of the movement of his/her engine’s pistons, we all need epistemological structure to interact and stack Information together with digital machines, we feel the “breathing” of the network and the rising or lowering currents. The way to epistemological structure implies “philosophic harmonisation of logic” worldwide, based on these main components: Mathematics and Humanism in the same feedback loop. This is what has been happening with global software products. What is the state of this comprehension? We need to unravel it in a way that saves diversity while dancing on a common layer, we need peculiarity of existence, this is the outcome of searching over an unprecedented number of sources of knowledge. Ultimately, frameworks, as most of tools, incorporate knowledge to ease usage or even provide black-boxed usage. Is there any difference in this kind of usages? &lt;/p&gt;

&lt;p&gt;The sensation of third-­party-­user­-experience referred to cognitive inputs (estrangement), multiplied to the incredible set of digital media we use, is the central knot of the quippus [4] describing the necessity of moving from framework to framework. The movement/process itself becomes Science (Systems Thinking [5]), the importance of meta-skills (reading, writing, learning, possibly very fast) surges. Every one of these experiences needs representation (reading) and binary decision-making (writing) finely tuned on the medium delivering the experience, to allow understanding. The feedback loop dances between man and medium/machine, and the third space in-between, the interface. Reading a proper representation that allows interactions with the medium via the interface (somebody called this loop Cyberspace or, in some quite weird times in the past Will-Representation [6]) is a matter of knowing codes, languages, and metalanguages on which anything, society economics communication, nowadays happens to run. We call this way of solving the problem (aka managing the fire) ‘medium-driven approach to the being-search​’, as differentiating itself to a theory- (or proof-) driven approach to Knowledge. Some day-by-day practical implementations of this  are research, “code literacy” or more in general pattern-recognition. This is now happening not by observing the manifest behaviour of units (that sounds theory driven isn’t it?), but instead by studying the tools they are massively using (a more “theoristic” approach) and how they are leveraged by the units, that is possibly one way to have some gist of the concept of Complexity. The preferred vehicles of this flow among computing models, media, societies are &lt;em&gt;scientific discourses&lt;/em&gt; [8] that, in this case, are hybridisation of natural and artificial languages (algorithms); for which we need to absorb the tools of Cybernetics and Computer Science. As a starter, what we are trying to do here is to characterise what “framework” “method” and “technique” actually mean in this new context.&lt;/p&gt;

&lt;h4&gt;
  
  
  II — A nomadic approach: continuous differential adjustment
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;p&gt;“And the reason that such complexity is not usually seen in human artifacts (tools or machines) is just that in building these we tend in effect to use programs that are specially chosen to give only behaviour simple enough for us to be able to see that it will achieve the purpose we want.” — S. Wolfram, 2002&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Chain production (Fordism­-Taylorism) had been the way to mass development until current times. Since not so recent time industries have developed fully automated facilities, or even entire segments of industry; they define an output exclusively through machines controlled by few technicians. This movement from the tool to the robot had surely wide opened attractive scenarios for businesses in the services industry, through reallocation of workforce and the improvements in automated tasks and calculations. The goods produced by these facilities have been conquering the markets and found place into our lives; with shapes and materials but, above all, because of the huge immaterial knowledge they carry. How they influence the psychology and the sociology of people? What is the impact into the personal sphere of individuals? Which level of adaptation is necessary to use them consistently? These software-intensive objects (software in this case intended as the immaterial added value embodied in the products) bring a peculiar epistemological style compared to Tayloristic goods, that makes them the top vehicles for a new metabolism of knowledge. This is a trend and getting even more evident for 3D-printed products and eventually future SPIMEs (cloud-based blueprints deployed over automated industrial feedback loops [7]). SPIMEs are ultimately “fully artificial being-search”, while human beings are nowadays, in the context of cognition, &lt;em&gt;“human-machine being-search”&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;The process of “to be“[9], &lt;em&gt;being-search&lt;/em&gt; for us, is adapting the shapes we use in logical thinking, aiming to a “continuous analysis of different types of transformation” (M. Foucault, 1978, in our interpretation we assume “transformation” in the meaning defined by Ashby [10]); probably the most important group of transformations is &lt;em&gt;framework/paradigm shift&lt;/em&gt;, this kind appears to happen much more often in cognitive system behaving in highly-interconnected networks (what somebody calls "liquidity" of opinion). Going beyond the fixed “shape that programs the empirical world by the imposition of his teleology”. We assume here, this is a &lt;em&gt;process&lt;/em&gt; of leaving the way of interpreting shift as discontinuity,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“… with the aim of removing the terms of totalitarian history from epistemé, using instead differential analysis.” — M. Foucault&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This kind of approach, in the end, is typical of fairly acknowledged media. Modern approaches to the experiment (a “Proof-based epistemology” or complete Formal Logic that witnessed the first cracks appearing with Gödel) was an imposition of teleology (a mechanical system of actions and reactions). In need for new “stable” shapes we are experiencing in our representation abstract and concrete objects, their designers impose a representation of reality using, according to Foucault and Wolfram, a kind of unilateral schema on the empirical world. We are witnessing increase in changes of representations with increasing popularity of Making and Coding. How programming concepts made a switch of paradigm possible? How this paradigm switch touch our cognition? How this ledger of meta-tools (programming languages, protocols, data pipes) that is the Internet is radically changing the way people does Science? Some points: less stability, more decision-making in selecting sources, more powerful frameworks (collection of shapes and/or transformation) but more prone to evolution and/or obsolescence. The eventually probably the biggest issue we are facing: how can we handle being in societies with high-degree and frequency of framework/paradigm shift?&lt;/p&gt;

&lt;p&gt;Computational sciences (see computational Linguistics or computational Biology, Genetics, ...) have nature of ‘search for code’ more than search for theories? This kind of search has been involving mainly mathematical and philosophical works, to reach a terrible conceptual breakthrough (summed by Hofstadter, 1976), realised cognitively by widely distributed Internet. Keyword of this unveiling track is the word medium. Medium as a vehicle, a tool, a machine/medium (a system part of a teleological loop): an inter-braiding of human machine and interface: a way of dealing between increasing heights in the morphology of Knowledge. This is an overview about what we can say up to now about the being-search; picking up the first part of our sentence above: “human-machine“ or “machine-mind“, it is up to us, digital-intensive workers, to give a practical example of what it means a proper (truthful, authentic) collaboration among humans and computational devices [12] through languages, frameworks, paradigms for software. &lt;/p&gt;

&lt;p&gt;[1] &lt;a href="https://www.scientificamerican.com/article/claude-e-shannon-founder/"&gt;https://www.scientificamerican.com/article/claude-e-shannon-founder/&lt;/a&gt;&lt;br&gt;
[2] &lt;a href="https://en.wiktionary.org/wiki/lego#Latin"&gt;https://en.wiktionary.org/wiki/lego#Latin&lt;/a&gt;&lt;br&gt;
[3] &lt;a href="https://en.wiktionary.org/wiki/architrave#English"&gt;https://en.wiktionary.org/wiki/architrave#English&lt;/a&gt;&lt;br&gt;
[4] &lt;a href="https://en.wiktionary.org/wiki/khipu#Quechua"&gt;https://en.wiktionary.org/wiki/khipu#Quechua&lt;/a&gt;&lt;br&gt;
[5] &lt;a href="https://en.wikiversity.org/wiki/Systems_Thinking"&gt;https://en.wikiversity.org/wiki/Systems_Thinking&lt;/a&gt;&lt;br&gt;
[6] &lt;a href="http://critique-of-pure-reason.com/schopenhauers-key-concepts-1-representation-vostellung/"&gt;http://critique-of-pure-reason.com/schopenhauers-key-concepts-1-representation-vostellung/&lt;/a&gt;&lt;br&gt;
[7] &lt;a href="https://en.wikipedia.org/wiki/Spime#Concept"&gt;https://en.wikipedia.org/wiki/Spime#Concept&lt;/a&gt;&lt;br&gt;
[8] &lt;a href="http://www.massey.ac.nz/%7Ealock/theory/foucault.htm"&gt;http://www.massey.ac.nz/~alock/theory/foucault.htm&lt;/a&gt;&lt;br&gt;
[9] as starting point: &lt;a href="https://en.wikipedia.org/wiki/Being_and_Time"&gt;https://en.wikipedia.org/wiki/Being_and_Time&lt;/a&gt;&lt;br&gt;
[10] &lt;a href="https://en.wikipedia.org/wiki/W._Ross_Ashby#Publications"&gt;https://en.wikipedia.org/wiki/W._Ross_Ashby#Publications&lt;/a&gt;&lt;br&gt;
[11] &lt;a href="https://pdfs.semanticscholar.org/24d2/3b944b269356f88dcefd5536b02c4636bc3f.pdf"&gt;https://pdfs.semanticscholar.org/24d2/3b944b269356f88dcefd5536b02c4636bc3f.pdf&lt;/a&gt;&lt;br&gt;
[12] &lt;a href="https://en.wikipedia.org/wiki/Garry_Kasparov#Chess_and_computers"&gt;https://en.wikipedia.org/wiki/Garry_Kasparov#Chess_and_computers&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copyright @ Lorenzo github.com/Mec-iS 2007-2019&lt;br&gt;
This is re-edited, corrected and completed edition of the blog post &lt;a href="https://medium.com/@lorenzogotuned/personal-history-of-computing-part-1-3bc340c80072"&gt;published here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>philosophy</category>
      <category>digitalage</category>
      <category>history</category>
      <category>information</category>
    </item>
    <item>
      <title>Python Hydra: Making Summer Great by Hacking Web APIs</title>
      <dc:creator>Lorenzo (Mec-iS)</dc:creator>
      <pubDate>Fri, 12 Apr 2019 15:08:25 +0000</pubDate>
      <link>https://dev.to/tuned/python-hydra-making-summer-great-by-hacking-web-apis-a0o</link>
      <guid>https://dev.to/tuned/python-hydra-making-summer-great-by-hacking-web-apis-a0o</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fra66m6eh0vf2jackvbcg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fra66m6eh0vf2jackvbcg.png" alt="diagram describing interactions about data objects (Python-Hydra GSOC-2017 working group)" width="756" height="346"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is a blog from 2017, original of this post can be found &lt;a href="https://medium.com/w3c-hydra-development-community/gsoc-2017-python-hydra-making-summer-great-by-hacking-web-apis-b2d8b2452ee9" rel="noopener noreferrer"&gt;here&lt;/a&gt;. I thought to propose a reedited version here, with some updates and additions. The activities mentioned in this post are the first steps that brought to the foundation of &lt;a href="http://hydraecosystem.org" rel="noopener noreferrer"&gt;Hydra Ecosystem&lt;/a&gt;, our brand-new Open Source Organisation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;W&lt;/strong&gt;ith the same enthusiasm this year as well, my adventure as Mentor for Google's summer programme (&lt;em&gt;Summer of Code&lt;/em&gt; or GSOC) has happily started and been completed. A great opportunity is offered to students world-wide to understand the Open Source ecosystem and experience real-job activities on the field of real-world OS organizations, by contributing to software repositories while been funded by Google Open Source. This year I managed to organize a super-powered team, putting together efforts from:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python Software Foundation's mentorship programme, very active in facilitating access for smaller OS organizations;&lt;/li&gt;
&lt;li&gt;W3C Hydra developing group that is designing a very interesting specification to make Web APIs (in particular REST) to communicate automatically (see &lt;a href="https://en.wikipedia.org/wiki/Hypermedia" rel="noopener noreferrer"&gt;Hypermedia for a general introduction&lt;/a&gt;);&lt;/li&gt;
&lt;li&gt;Two kind students that had the great feeling for understanding the importance of what we are doing, and decided to submit proposals to realize the project: Chris Andrew and Akshay Dahiya.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Hydra
&lt;/h2&gt;

&lt;p&gt;Hydra is a tool defined in a draft registered at W3C and the specification is in &lt;a href="https://github.com/HydraCG/Specifications" rel="noopener noreferrer"&gt;active development&lt;/a&gt; by Markus Lanthaler and the members of the team (video presentation &lt;a href="https://www.youtube.com/watch?v=fJCtaNRxg9M" rel="noopener noreferrer"&gt;here&lt;/a&gt;) in the working group.&lt;/p&gt;

&lt;p&gt;Hydra is a client-server framework (based on W3C's RDF) used to describe and publish Web APIs to network agents. Through modeling a high-level data-structure ("ApiDocumentation" or shorter "ApiDoc", written in &lt;a href="https://json-ld.org/" rel="noopener noreferrer"&gt;JSON-LD&lt;/a&gt;), leveraging the semantic tools provided by the specification, developers can make their data accessible to any Hydra-aware client around.&lt;/p&gt;

&lt;h2&gt;
  
  
  Accomplishments
&lt;/h2&gt;

&lt;p&gt;The Hydra client-server system that makes possible the implementation of this framework can now be set up easily by adding your own custom ApiDoc to a server software codenamed &lt;a href="https://github.com/HTTP-APIs/hydrus" rel="noopener noreferrer"&gt;hydrus (Hydra Universal Server)&lt;/a&gt;, that has been developed by the students this summer. Hydrus let developers to run the system through a two-steps procedure: writing once their ApiDoc and start-up the server with or without pre-loaded data (complete instructions &lt;a href="https://github.com/HTTP-APIs/hydrus#hydrus-" rel="noopener noreferrer"&gt;here&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;ApiDoc can be written once at system design phase and amended later if needed; clients asks for the ApiDoc when handshaking with the server and this way they are automatically able to operate the interface, implementing the business logic that drives them. Once the system is set up server-side with the right documentation and data, any Hydra-aware client can connect and start operating with the interface (clients can be found here and here, here an example of ApiDocumentation).&lt;/p&gt;

&lt;p&gt;The next idea that has been implemented during this summer is a visualization of all the work done by Hydra in the background of a complex network. That is why we came up with developing a graphic interface that simulates a real-world scenario and displays every API interactions going on. We called this browser application &lt;a href="https://github.com/HTTP-APIs/hydra-flock-demo/blob/master/README.md" rel="noopener noreferrer"&gt;&lt;strong&gt;hydra-flock-demo&lt;/strong&gt;&lt;/a&gt;. The flight of a flock of commercial drones is simulated to demonstrate how Hydra documentation can make the built-in clients in every drone to communicate changes of state to a central server; every component in the simulation is both a Hydra-aware client and a &lt;strong&gt;hydrus&lt;/strong&gt; server instance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Unexpected outcome
&lt;/h2&gt;

&lt;p&gt;The ones described above are quite cool achievements to demonstrate how a Python-Hydra implementation can easily bring automation in a network of Web interfaces. As spill-overs we have been experiencing great insights into designing and implementing with Python functional programming tools a quite usable small-scale DBMS for storing semantic triples using PostgreSQL, &lt;a href="https://www.hydraecosystem.org/Design" rel="noopener noreferrer"&gt;see the design here and data model here&lt;/a&gt;. Furthermore, some nice options came up about how to index this data using an &lt;a href="http://www.vldb.org/pvldb/1/1453965.pdf" rel="noopener noreferrer"&gt;HexaStore&lt;/a&gt; for example, all the experience has been really fruitful since we started with the preparation in February. More insights have arose from understanding smart devices' operational procedures and how to make them send/receive signals and perform message-passing operations efficiently, the protocol for drones' communications is super-simple and clear, meant to be efficient in terms of frequency of messages and size of payloads.&lt;/p&gt;

&lt;p&gt;All this material is going to be object of live-demo events to bring these tools to reach a wider audience. You can read students blog posts describing in more detail this adventure &lt;a href="https://lnkd.in/gq3Sgd4" rel="noopener noreferrer"&gt;here&lt;/a&gt; and &lt;a href="https://lnkd.in/gGn4X-u" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Potential growth
&lt;/h2&gt;

&lt;p&gt;In the scenario of interconnected devices (IoT) and linked knowledge-bases, Hydra and its ecosystem of tools can lead to higher level of integration and automation between agents. The possibility of driving a network of APIs by adjusting and improving their documentation is incredibly interesting for data but also for cloud services.&lt;/p&gt;

&lt;p&gt;Thanks again to Python Software Foundation, W3C-Hydra and Google.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where to start
&lt;/h2&gt;

&lt;p&gt;We are developing an &lt;a href="https://github.com/HTTP-APIs/hydrus-real-world-app/issues/1" rel="noopener noreferrer"&gt;ApiDoc from scratch in this repository&lt;/a&gt;. That is the easiest way of having a grasp about what Hydra is about.&lt;/p&gt;

&lt;h2&gt;
  
  
  Update
&lt;/h2&gt;

&lt;p&gt;After two year of dedication these activities brought to the foundation of &lt;a href="http://hydraecosystem.org" rel="noopener noreferrer"&gt;Hydra Ecosystem&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;M. Lanthaler, "Full-on Hypermedia APIs with Hydra," presented at the API Strategy &amp;amp; Practice Conference.&lt;/li&gt;
&lt;li&gt;C. Pautasso, E. Wilde, and R. Alarcon (editors), "REST: Advanced Research Topics and Practical Applications," Springer New York, 2014.&lt;/li&gt;
&lt;li&gt;L. Richardson, M. Amundsen, and S. Ruby, "RESTful Web APIs," O'Reilly Media, 2013.&lt;/li&gt;
&lt;li&gt;M. Lanthaler, "Building Next-Generation Web APIs with JSON-LD and Hydra," presented at the Symfony Live Portland 2013 [slides] [video].&lt;/li&gt;
&lt;li&gt;M. Lanthaler and C. Gütl, "Hydra: A Vocabulary for Hypermedia-Driven Web APIs," in Proceedings of the 6th Workshop on Linked Data on the Web (LDOW2013) at the 22nd International World Wide Web Conference (WWW2013), 2013 [slides].&lt;/li&gt;
&lt;li&gt;M. Lanthaler, "Creating 3rd Generation Web APIs with Hydra," in Proceedings of the 22nd International World Wide Web Conference (WWW2013), 2013, pp. 35–37 [slides].&lt;/li&gt;
&lt;li&gt;M. Lanthaler and C. Gütl, "Model Your Application Domain, Not Your JSON Structures," in Proceedings of the 4th International Workshop on RESTful Design (WS-REST 2013) at the 22nd International World Wide Web Conference (WWW2013), 2013, pp. 1415–1420 [slides].&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>http</category>
      <category>webapis</category>
      <category>rest</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Deep Learning is officially "a critical component of computing" </title>
      <dc:creator>Lorenzo (Mec-iS)</dc:creator>
      <pubDate>Thu, 28 Mar 2019 11:35:56 +0000</pubDate>
      <link>https://dev.to/tuned/deep-learning-is-officially-a-critical-component-of-computing-lbc</link>
      <guid>https://dev.to/tuned/deep-learning-is-officially-a-critical-component-of-computing-lbc</guid>
      <description>&lt;p&gt;according to Turing Award committee&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.bbc.co.uk/news/amp/technology-47721129"&gt;https://www.bbc.co.uk/news/amp/technology-47721129&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Being a Mentor at Google Summer of Code </title>
      <dc:creator>Lorenzo (Mec-iS)</dc:creator>
      <pubDate>Wed, 27 Mar 2019 11:36:33 +0000</pubDate>
      <link>https://dev.to/tuned/being-a-mentor-at-google-summer-of-code-6ok</link>
      <guid>https://dev.to/tuned/being-a-mentor-at-google-summer-of-code-6ok</guid>
      <description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;I am Lorenzo (@Mec-iS), administrator and mentor at &lt;a href="http://hydraecosystem.org" rel="noopener noreferrer"&gt;&lt;strong&gt;hydraecosystem.org&lt;/strong&gt;&lt;/a&gt; and contributor for Python Software Foundation Mentorship Program.&lt;/p&gt;

&lt;p&gt;We are an organisation at its third year developing for Google Open Source Program, in particular at &lt;a href="https://summerofcode.withgoogle.com/" rel="noopener noreferrer"&gt;Google Summer Of Code (GSOC)&lt;/a&gt;, take a little time to read about as it is a great driver for Open Source initiatives!&lt;/p&gt;

&lt;p&gt;We are looking for mentors to help with &lt;a href="https://github.com/HTTP-APIs" rel="noopener noreferrer"&gt;code-reviewing students' Python contributions on Github and/or review/write our documentation&lt;/a&gt;. For an overview you can also take a look to &lt;a href="https://medium.com/w3c-hydra-development-community" rel="noopener noreferrer"&gt;our blog&lt;/a&gt;. If you are interested we can provide support for becoming a good mentor and loads of knowledge about REST Web APIs and Python.&lt;/p&gt;

&lt;p&gt;Cheers,&lt;/p&gt;

&lt;p&gt;Lorenzo&lt;/p&gt;

&lt;p&gt;PS. You can join via &lt;a href="https://hydraecosystem.slack.com" rel="noopener noreferrer"&gt;Slack&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F7puxni62sxrapwixg2kc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F7puxni62sxrapwixg2kc.png" alt="logo"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>python</category>
      <category>webapi</category>
      <category>mentoring</category>
    </item>
  </channel>
</rss>
