<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Bilel Methnani on Medium]]></title>
        <description><![CDATA[Stories by Bilel Methnani on Medium]]></description>
        <link>https://medium.com/@boolhak?source=rss-20b3dcdd51b2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*tgQU8neQ2gh2bndx.jpg</url>
            <title>Stories by Bilel Methnani on Medium</title>
            <link>https://medium.com/@boolhak?source=rss-20b3dcdd51b2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 23:14:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@boolhak/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Android NDK: Deep dive (Part 1)]]></title>
            <link>https://medium.com/@boolhak/android-ndk-deep-dive-part-1-498118728042?source=rss-20b3dcdd51b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/498118728042</guid>
            <category><![CDATA[android-ndk]]></category>
            <dc:creator><![CDATA[Bilel Methnani]]></dc:creator>
            <pubDate>Sun, 19 Sep 2021 03:17:02 GMT</pubDate>
            <atom:updated>2021-09-20T09:46:11.375Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome to the dark side of Android development, for so long the android NDK have been a voodoo science for so long and add to this the C++ syntax we get the best formula for a developer black hole.</p><p>So many projects using the NDK, but so far there is no clear way or path to learn this forbitten knowledge. I should tell you from the beginning, I am no expert in the NDK land. This series of tutorials is an honest shot to force my self to learn this topic. I simply refuse to see so many wonderful projects using the NDK and do nothing about it.</p><p>Let’s start from the beginning, if you google “Android NDK” like every expert developer will do when reaching for the unknown. First result the official documentation of google. <a href="https://developer.android.com/ndk">https://developer.android.com/ndk</a></p><p>They will tell you: “The Android NDK is a toolset that lets you implement parts of your app in native code, using languages such as C and C++. For certain types of apps, this can help you reuse code libraries written in those languages.” Oh, nice that’s exactly what I want to do. They have a guide too. Let’s see.</p><p><a href="https://developer.android.com/ndk/guides">https://developer.android.com/ndk/guides</a></p><p>A warning from the beginning “The NDK may not be appropriate for most novice Android programmers”</p><p>Funny 😊, now I want it more. You want to scare me, right? Well, let’s see.</p><p>Ok, you will need android studio 2.2 or higher.</p><p>They are saying that you have a C or a C++ code, the NDK will compile it for you, then you can call your C or C++ code from the java side through the JNI (Java Native Interface).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*nYokTIxdytzlBc4xEZADtg.png" /></figure><p>We have two worlds man! The real one (Android java application) and the spirit world (C code). You will need a medium to communicate with it (JNI): the Java Native Interface, wait are we using Kotlin now or Java or what? So, for Kotlin it would be the KNI, don’t know and don’t care for now. Java it is. any ways I never liked the new boy. I don’t like hippies. Ok, sorry this is not a java vs Kotlin war. This is the NDK.</p><p>What! Typical google documentation, after all we have been through now, after all of this. Real world, Spirit world and shit you are telling me “Android Studio’s default build tool to compile native libraries is CMake” Wtf man, CMake? What is CMake? Fine. Let’s google it. In Wikipedia page about CMake:</p><p><a href="https://en.wikipedia.org/wiki/CMake">CMake - Wikipedia</a></p><p>“CMake is not a build system but rather it generates another system’s build files” not confusing at all.</p><p>Whatever, I will consider it a build tool, sue me. I will name it the Gradle of C.</p><p>In the official site of CMake please lessen to this:</p><p><a href="https://cmake.org/">https://cmake.org/</a></p><p>“CMake is an open-source, cross-platform family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent ………., cross-platform build environment for open-source projects such as ITK and VTK.”</p><p>Ah, now I get it. It is a cross-platform build environment, right. Gradle of C. Did we run out of simple words?</p><p>What a wonderful guide, back talking about the NDK build and CMake build. What! 2 versions of build.</p><p>The old one is the ndk-build with Android.mk and Application.mk files but the new one will use CMakeLists.txt aka CMake. To understand this, I have a video from 2019 Google IO to help us understand. In the beginning of the video the tall one (Elliott Hughes) said: “We do not want to get any new C++ users. We hope that you will use Java or Kotlin if you can …”. Yeah, you hope.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FL9GF_X-cq3E%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DL9GF_X-cq3E&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FL9GF_X-cq3E%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/918bad4fe51c2181e9dee59d4125104f/href">https://medium.com/media/918bad4fe51c2181e9dee59d4125104f/href</a></iframe><p>They said “we took over” soooooo many times. That’s why we have CMake now. Thank you, the video is so depressing man. There is no need to watch the video, I recommend not watching it.</p><p>Conclusion:</p><p>From what we have seen on the internet and through space time that google don’t want you to do C and C++ development on Android. Hopefully this alone will motivate you like me to learn C and C++ and rock the shit out of that NDK. Once more, I am no expert in android ndk development. Feel free to comment or correct me on anything. Stay tuned for part 2.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=498118728042" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 4: Create a Hyperledger Fabric composer project]]></title>
            <link>https://medium.com/@boolhak/part-4-create-a-hyperledger-fabric-composer-project-d3fcc089735c?source=rss-20b3dcdd51b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3fcc089735c</guid>
            <category><![CDATA[hyperledger-fabric]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Bilel Methnani]]></dc:creator>
            <pubDate>Thu, 09 Aug 2018 22:32:54 GMT</pubDate>
            <atom:updated>2018-08-13T17:18:20.634Z</atom:updated>
            <content:encoded><![CDATA[<p>That’s it. No more installing stuff and fancy theory. Show me the code baby. This is the 4th part and I must write some code. But before we begin, is there any scientific viable explanation why women and specially my wife wins every argument. I swear that she can convince the ledger that the previous block hash was her mother’s phone number. 100% win rate. I was thinking maybe we can use this. The moment I get the exact algorithm I will freaking implement it and convince all bitcoin nodes that I have the right nonce. Until then let’s get back to our sheep like an old wise French man sad.</p><p>Last night like every lovely summer night in Tunisia. We were in the café fighting about “spaces or tabs”, do we really need a blockchain (of Corse we do), drinking coffee and telling jokes. The problem with jokes is that with time we forgot who came up with it. So, to keep the score right and to know why sharks turn around human beings before they eat them we must store this in a ledger, a Hyperledger fabric ledger</p><p>To create a biz network project, we will use the yeoman code generator:</p><pre>yo  hyperledger-composer</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*GTU26-O0fBZS25ysVCquDQ.png" /></figure><p>Select Business network.</p><p>and an interrogation starts:</p><p>This is a screenshot of my answers and remember the 5th rule of software development “if you type it, it’s not copying.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*SetRYkt88GF0CJYWIDOiOA.png" /></figure><p>Be aware of the last question, a tricky question. Say “Yes” to create an empty template.</p><p>Nice… nice, we have a project. Let’s find out what’s inside it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*IqlnKoexDzegWwpDq7_iAA.png" /></figure><p>First thing to look at is the “package.json” file.</p><pre>{<br>   &quot;engines&quot;:{<br>      &quot;composer&quot;:&quot;^0.19.13&quot;<br>   },<br>   &quot;name&quot;:&quot;joke-bna&quot;,<br>   &quot;version&quot;:&quot;0.0.1&quot;,<br>   &quot;description&quot;:&quot;A bna to track the original  owner of a joke&quot;,<br>   &quot;scripts&quot;:{<br>      &quot;prepublish&quot;:&quot;mkdirp ./dist &amp;&amp; composer archive create --sourceType dir --sourceName . -a ./dist/joke-bna.bna&quot;,<br>      &quot;pretest&quot;:&quot;npm run lint&quot;,<br>      &quot;lint&quot;:&quot;eslint .&quot;,<br>      &quot;test&quot;:&quot;nyc mocha -t 0 test/*.js &amp;&amp; cucumber-js&quot;<br>   },<br>   &quot;keywords&quot;:[<br>      &quot;composer&quot;,<br>      &quot;composer-network&quot;<br>   ],<br>   &quot;author&quot;:&quot;Bilel Methnani&quot;,<br>   &quot;email&quot;:&quot;<a href="/service/mailto:bme@peak-cs.com">bme@peak-cs.com</a>&quot;,<br>   &quot;license&quot;:&quot;Apache-2.0&quot;,<br>   &quot;devDependencies&quot;:{<br>      &quot;composer-admin&quot;:&quot;^0.19.13&quot;,<br>      &quot;composer-cli&quot;:&quot;^0.19.13&quot;,<br>      &quot;composer-client&quot;:&quot;^0.19.13&quot;,<br>      &quot;composer-common&quot;:&quot;^0.19.13&quot;,<br>      &quot;composer-connector-embedded&quot;:&quot;^0.19.13&quot;,<br>      &quot;composer-cucumber-steps&quot;:&quot;^0.19.13&quot;,<br>      &quot;chai&quot;:&quot;latest&quot;,<br>      &quot;chai-as-promised&quot;:&quot;latest&quot;,<br>      &quot;cucumber&quot;:&quot;^2.2.0&quot;,<br>      &quot;eslint&quot;:&quot;latest&quot;,<br>      &quot;nyc&quot;:&quot;latest&quot;,<br>      &quot;mkdirp&quot;:&quot;latest&quot;,<br>      &quot;mocha&quot;:&quot;latest&quot;<br>   }<br>}</pre><p>From this json file you will need to keep in mind two simple things:</p><p>The name “joke-bna” and the version “0.0.1”.</p><p>What’s next, a models folder, shit… let’s open it:</p><p>We will find a file with an extension “.cto”, that’s weird. Let’s google it.</p><p>From <a href="https://datatypes.net/open-cto-files">https://datatypes.net/open-cto-files</a> I give you this screenshot</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*PG1lUzBAOJKQj3wf0lD8Cw.png" /></figure><p>Ok, that’s officially weird. This have nothing to do with Hyperledger. Back to track.</p><p>When we open it, we find the Apache License and one single line.</p><pre>Namespace com.peak.joke</pre><p>On top of it a nice comment saying</p><pre>/**</pre><pre>*Write your model definitions here</pre><pre>*/</pre><p>You heard the man. We need a joke model. The joke in the context of this application is something that we want to store in the ledger, so we can easily assume that: in this context a joke is an asset, to do that in composer:</p><pre>asset Joke identified by jokeId {<br>  o String jokeId<br>}</pre><p>Ok, that’s self-explanatory. We have an asset called Joke with an Id of type String called jokeId. But wtf is that circle in front of String. Calm down it’s the lowercase letter o. I have seen worst. You’re the boss. Nothing to complain about. But why o? it’s so confusing. The first time I saw that. I said to myself. It should be a special character. Let’s find out how to write it, I copied the thing from the documentation and google it. Shit it’s an o. noooooo…. You got me.</p><p>Add to that another small o to declare the body, but all jokes are not equal. We have a lot of type of jokes. That’s when we know that we need an enum. An old fashion enum, to my surprise composer have an enum with a twist. The o thing in the beginning of every line. The result is:</p><pre>namespace com.peak.joke</pre><pre>asset Joke identified by jokeId{</pre><pre>   o String jokeId</pre><pre>   o JokeType jokeType</pre><pre>   o String body</pre><pre>}</pre><pre>enum JokeType{</pre><pre>   o ANECDOTE</pre><pre>   o KNOCK_KNOCK</pre><pre>   o ONE_LINER</pre><pre>}</pre><p>Nice!! let’s run it, compile it, … the right word is “deploy it”. We will be using the playground.</p><p>First we create a folder called “dist” then cd into it assuming that we are in the project folder “joke-bna” with the command:</p><pre>mkdir dist &amp;&amp; cd dist</pre><p>The command that we will be using is:</p><pre>composer archive create</pre><p>Let’s view the options that we should use with this command:</p><p>-t : the type of the input containing the files. It’s a directory so put “dir”</p><p>-n: where to file the source files. In this case it’s in the parent directory so put “../”</p><p>The whole command would be:</p><pre>composer archive create -t dir -n ../</pre><p>You should see a new lovely .bna file in the dist folder.</p><p>Launch the composer playground</p><pre>composer-playground</pre><p>Select Deploy a new business network from “Connection: web browser” section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*NIdeKveUwYRbeoWKTo8GcQ.png" /></figure><p>Browse to the location of the .bna file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fteu_muSSC2Dmu0rqCNGIQ.png" /></figure><p>Then click on deploy.</p><p>You should see a new view looking like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*anLB6DEMtTTwny2dfl5g3w.png" /></figure><p>Click on connect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1wLuIBLJ5fZzsKjaW0PtTQ.png" /></figure><p>We see that we have our project loaded in the project, click on Test tab on the top.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZnAc9uD1lfJ-VmvdyKSjcw.png" /></figure><p>We see that we have an asset called joke, click on Create New asset to create a new joke</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*-Wx3G3rUgoI5rPqtJq4u-w.png" /></figure><p>We find a json file, some fields are auto generated values. Write the body of your joke then click on create new. I can only congratulate you, you submitted your first asset into the ledger.</p><p><a href="https://github.com/BoolHak/Joke-bna">Source code on github</a></p><p>Stay tuned for part 5.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3fcc089735c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 3: About Hyperledger Composer cards]]></title>
            <link>https://medium.com/@boolhak/part-3-about-hyperledger-composer-cards-b1b523b6fa63?source=rss-20b3dcdd51b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/b1b523b6fa63</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[hyperledger-fabric]]></category>
            <dc:creator><![CDATA[Bilel Methnani]]></dc:creator>
            <pubDate>Wed, 08 Aug 2018 16:26:24 GMT</pubDate>
            <atom:updated>2018-08-09T22:36:10.218Z</atom:updated>
            <content:encoded><![CDATA[<p>The closest thing that I can think of similar to Hyperledger composer is Las Vegas.</p><p>In a casino there is the owner, the dealers and the players.</p><p>A casino can be part of a gaming corporation that contains several casinos in various locations we call the corporation an “organization”</p><p>Let’s start with the owner, in Hyperledger we call him the “peer admin”. He is not in there to play blackjack. He created the casino, recruited the dealers, installed the games and made the rules. In that casino you can play multiple gambling games not only blackjack, games can be played across multiple casino via VR. That’s why we call games a “business networks”. Anything used in the game like ships and cards are called “Assets” and every action executed by the player are called “Transactions”.</p><p>Dealers or what we call “network administrators”, they are recruited by the owner and do not make the rules or change them. They are in there to accept the players and serve cards.</p><p>Players or what we call “Participants” they are in there to simply play, but they will need the dealer permission to join any game. And Dealers can give players a VIP permission to invite other players to the game.</p><p>In the Hyperledger casino, you will need a badge for every action you do, that badge contains also the map of the casino, so you don’t get lost. We call badges a “card”.</p><p>This analogy is not 100% accurate, but hopefully it did give you a good idea about the subject.</p><p>Do you remember in the script that we launched in the part 2.</p><pre>./createPeerAdminCard.sh</pre><p>By launching this script, we did create a card for the peer admin.</p><p>To list all stored cards on your machine you can execute the command</p><pre>composer card list</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*iLaowvvnxeAGYZky8tI3sA.png" /></figure><p>Let’s find out where to find the card on disc</p><p>Go to your root directory then go to the top menu →View-&gt;Show hidden files:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*FcIkw_retY-7rQb2FO5kGg.png" /></figure><p>Then you will find a folder called “.composer”</p><p>Open it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*TA8wxKkberxvFjrR9rEcZg.png" /></figure><p>Inside the cards folder we find that every card is contained in its own folder</p><pre>/ PeerAdmin@hlfv1</pre><pre>      connection.json</pre><pre>      metadata.json</pre><pre>      /credentials</pre><p>The folder essentially contains 3 things:</p><p>1- The crypto materials: certificate and private key inside the folder “credentials”</p><p>2- “metadata” json file containing some information about the card owner and the list of the roles</p><pre>{  <br>   <strong>&quot;version&quot;</strong>:1,<br>   <strong>&quot;userName&quot;</strong>:&quot;PeerAdmin&quot;,<br>   <strong>&quot;roles&quot;</strong>:[  <br>      &quot;PeerAdmin&quot;,<br>      &quot;ChannelAdmin&quot;<br>   ]<br>}</pre><p>3- “connection.json” is describing how can I connect to the different component of the Hyperledger.</p><pre>{<br>   &quot;name&quot;:&quot;hlfv1&quot;,<br>   &quot;x-type&quot;:&quot;hlfv1&quot;,<br>   &quot;x-commitTimeout&quot;:300,<br>   &quot;version&quot;:&quot;1.0.0&quot;,<br>   &quot;client&quot;:{<br>      &quot;organization&quot;:&quot;Org1&quot;,<br>      &quot;connection&quot;:{<br>         &quot;timeout&quot;:{<br>            &quot;peer&quot;:{<br>               &quot;endorser&quot;:&quot;300&quot;,<br>               &quot;eventHub&quot;:&quot;300&quot;,<br>               &quot;eventReg&quot;:&quot;300&quot;<br>            },<br>            &quot;orderer&quot;:&quot;300&quot;<br>         }<br>      }<br>   },<br>   &quot;channels&quot;:{<br>      &quot;composerchannel&quot;:{<br>         &quot;orderers&quot;:[<br>            &quot;orderer.example.com&quot;<br>         ],<br>         &quot;peers&quot;:{<br>            &quot;peer0.org1.example.com&quot;:{</pre><pre>}<br>         }<br>      }<br>   },<br>   &quot;organizations&quot;:{<br>      &quot;Org1&quot;:{<br>         &quot;mspid&quot;:&quot;Org1MSP&quot;,<br>         &quot;peers&quot;:[<br>            &quot;peer0.org1.example.com&quot;<br>         ],<br>         &quot;certificateAuthorities&quot;:[<br>            &quot;ca.org1.example.com&quot;<br>         ]<br>      }<br>   },<br>   &quot;orderers&quot;:{<br>      &quot;orderer.example.com&quot;:{<br>         &quot;url&quot;:&quot;grpc://localhost:7050&quot;<br>      }<br>   },<br>   &quot;peers&quot;:{<br>      &quot;peer0.org1.example.com&quot;:{<br>         &quot;url&quot;:&quot;grpc://localhost:7051&quot;,<br>         &quot;eventUrl&quot;:&quot;grpc://localhost:7053&quot;<br>      }<br>   },<br>   &quot;certificateAuthorities&quot;:{<br>      &quot;ca.org1.example.com&quot;:{<br>         &quot;url&quot;:&quot;<a href="http://localhost:7054/">http://localhost:7054</a>&quot;,<br>         &quot;caName&quot;:&quot;ca.org1.example.com&quot;<br>      }<br>   }<br>}</pre><p>Cards can be exported in a zip like file with the extension “.card” using the composer cli witch is basically putting the folder into a .card file.</p><p>Also, with the composer cli you can list, create, delete, import cards, don’t worry we will be using those commands in future tutorials.</p><p>So, in conclusion cards are used to connect to the business network and every action executed by the user requires the card to do it.</p><p><a href="https://medium.com/@boolhak/part-4-create-a-hyperledger-fabric-composer-project-d3fcc089735c">Part 4: Create a Hyperledger Fabric composer project</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1b523b6fa63" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 2: Install Hyperledger Fabric Composer on Ubuntu]]></title>
            <link>https://medium.com/@boolhak/part-2-install-hyperledger-fabric-composer-on-ubuntu-6403bc7d89c0?source=rss-20b3dcdd51b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/6403bc7d89c0</guid>
            <category><![CDATA[hyperledger-fabric]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Bilel Methnani]]></dc:creator>
            <pubDate>Sun, 05 Aug 2018 18:30:45 GMT</pubDate>
            <atom:updated>2018-08-08T16:27:29.453Z</atom:updated>
            <content:encoded><![CDATA[<p>I am a windows user. Yes, windows until world of tanks will be officially supported by Linux distributions I will be using windows, plus I am a C# programmer. Let’s not go into that rabbit hole. Let’s pretend that I am using ubuntu “Under the hood it is a Virtual Box VM”. Ok, I have a fresh machine (VM) running ubuntu 16.04.</p><p>“Hey but wait, you can install Hyperledger composer on windows”. Indeed Yes, you can. But I did promise you to keep things simple.</p><h3><strong>Step 1: Install the prerequisites</strong></h3><p>You will be needing curl, you can install it with the command:</p><p>sudo apt-get install curl</p><p>Downloading the prerequisites install script:</p><pre>curl -O https://hyperledger.github.io/composer/latest/prereqs-ubuntu.sh</pre><p>Give the script the total control over the planet:</p><pre>chmod u+x prereqs-ubuntu.sh</pre><p>then run it and hope for the best:</p><pre>./prereqs-ubuntu.sh</pre><p>Wait for a few minutes, then restart your machine or simply logout then login.</p><h3>Step 2: Installing the dev environment</h3><p>“Hey but wait, more things to install… this is boring”</p><p>The sooner we finish the better and by the way please don’t use su or sudo in this step. Well… you can, but good luck if you do, you will need it.</p><p>We start by installing the main gun: Composer CLI version 19</p><pre>npm install -g composer-cli@0.19</pre><p>then we install the rest server, yep you don’t need to write a rest server for your applications to communicate with the blockchain. Composer will do it for you. How cool is that. Very cool indeed.</p><pre>npm install -g composer-rest-server@0.19</pre><p>since we hate losing time creating projects structures and folders and stupid config files we better install a neat generator:</p><pre>npm install -g generator-hyperledger-composer@0.19<br>npm install -g yo</pre><p>Do you remember the playground from <a href="https://medium.com/@boolhak/part-1-what-is-hyperledger-fabric-composer-13bfb05e8079">part 1</a>? That cool application that you can play with. We are going to install it, we are going to use it many times during this tutorial and since we are working on a top-secret application we don’t want the composer team to know about it. We should keep it low until we finish this plan for world domination. “evil laugh”</p><pre>npm install -g composer-playground@0.19</pre><p>Cool, cool what’s next? An IDE, a nice IDE will make the experience more enjoyable. You can use whatever you want but Visual studio code have an extension for Hyperledger composer, it’s funny how Microsoft got it this time. Using the same tools as Atom to create a better IDE. Well done Microsoft! Anyways to install VSCode on ubuntu you can go to: <a href="https://code.visualstudio.com/download">https://code.visualstudio.com/download</a></p><p>Download the .deb file double click on it ubuntu software will pop up and ask you if you want to install it. Yes, probably you do. Enter your password wait for it… done.</p><p>Open the terminal in any folder write:</p><pre>code .</pre><p>if VSCode opens your good else have fun finding out why the hell visual studio did not install. Hopefully it will open. On the left side there is the extension tab click on it. Then in the search bar write: Hyperledger Composer, install the extension finally reload VSCode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*4QQNS_E2vCrRxxGINCMkQw.png" /></figure><h3>Step 3: install Fabric</h3><p>“What! Now we are installing fabric?”</p><p>Yes, shill down man. Almost done. Don’t quit on me. We are going to create a directory called fabric and cd into it with the command:</p><pre>mkdir ~/fabric &amp;&amp; cd ~/fabric</pre><p>then we must get the zip version of Linux that contains the installer and unzip it</p><pre>curl -O https://raw.githubusercontent.com/hyperledger/composer-tools/master/packages/fabric-dev-servers/fabric-dev-servers.tar.gz</pre><pre>tar -xvf fabric-dev-servers.tar.gz</pre><p>we want to download the fabric v1.1 so:</p><pre>export FABRIC_VERSION=hlfv11</pre><p>then we run the download script</p><pre>./downloadFabric.sh</pre><p>This will take a few minutes depending on your internet speed.</p><h3>Step 4: Start fabric</h3><p>“Wtf man, that was painful. I can’t believe I made it this far.”</p><p>If you made it this far. You can enjoy starting fabric on your local machine.</p><pre>./startFabric.sh</pre><p>Then you must create a peer admin card, don’t worry we will get to composer cards in details but for now run the script:</p><pre>./createPeerAdminCard.sh</pre><p>Finally run the composer playground</p><pre>composer-playground</pre><p>Yeah baby we made it. The playground should open on port 8080.</p><p>For more details you can read <a href="https://hyperledger.github.io/composer/latest/installing/installing-index.html">the official documentation</a></p><p>If you have any question, please feel free to comment.</p><p><a href="https://medium.com/@boolhak/part-3-about-hyperledger-composer-cards-b1b523b6fa63">Part 3: About Hyperledger Composer cards</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6403bc7d89c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 1: What is Hyperledger fabric composer]]></title>
            <link>https://medium.com/@boolhak/part-1-what-is-hyperledger-fabric-composer-13bfb05e8079?source=rss-20b3dcdd51b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/13bfb05e8079</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[hyperledger-fabric]]></category>
            <dc:creator><![CDATA[Bilel Methnani]]></dc:creator>
            <pubDate>Sun, 05 Aug 2018 02:12:32 GMT</pubDate>
            <atom:updated>2018-08-06T09:56:25.026Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WeIn5-XiC190I_4ZnaBOaw.png" /></figure><p>A few years ago, I worked as an android developer for a startup using open transactions to create a mobile payment solution. Since then I was fascinated by the world of cryptocurrency and the blockchain in general. The myth of the ninja code warrior Satoshi Nakamoto fighting the evil power of banks to liberate humanity from the dirty hands of capitalism. For the first time since a long-time bitcoin have a real value. The idea of trustless system is a brake throw in a world dominated by third party service providers that you should trust with your precious data to get things done. Conclusion: Blockchain is dope. The closest thing that I can work with is Ethereum. We can create a blockchain with Ethereum in a few clicks, plus we have smart contracts and shit, I can write the business logic in solidity and host it on the cloud, and bang I have my blockchain. Right? Yes, you can do that. But for me this gas thing that you must pay miners is not that charming. I don’t want a cryptocurrency to begin with. I just want a distributed ledger that I can use to store transactions between participants, a simple and elegant framework that I can easily integrate into my applications. And that my friends what Hyperledger fabric composer is. Yeah 3 words, Hyperledger: is the big project hosted by Linux Foundation, Fabric is the blockchain, composer is collection of tools to help developer work with fabric in other words “Hey man relax, look it’s JavaScript… we even have a <a href="https://composer-playground.mybluemix.net/">playground</a>…you can touch it…”</p><p>So, this is the first part of a series of tutorials that will guide you into the world of composer. I will try to make it as simple as possible. No crude concepts or complex architectures. Simply what you need to know to start working. We will create a simple application based on Hyperledger composer.</p><p><a href="https://medium.com/@boolhak/part-2-install-hyperledger-fabric-composer-on-ubuntu-6403bc7d89c0">Part 2: Install Hyperledger Fabric Composer on Ubuntu</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=13bfb05e8079" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android: a better ViewHolder]]></title>
            <link>https://medium.com/@boolhak/android-a-better-viewholder-bced38249afa?source=rss-20b3dcdd51b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/bced38249afa</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Bilel Methnani]]></dc:creator>
            <pubDate>Wed, 06 Jan 2016 13:56:43 GMT</pubDate>
            <atom:updated>2016-01-06T14:08:36.601Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>public static class ViewHolder {<br> <a href="http://twitter.com/SuppressWarnings">@SuppressWarnings</a>(“unchecked”)<br> public static &lt;T extends View&gt; T get(View view, int id) {<br> SparseArray&lt;View&gt; viewHolder = (SparseArray&lt;View&gt;) view.getTag();<br> if (viewHolder == null) {<br> viewHolder = new SparseArray&lt;&gt;();<br> view.setTag(viewHolder);<br> }<br> View childView = viewHolder.get(id);<br> if (childView == null) {<br> childView = view.findViewById(id);<br> viewHolder.put(id, childView);<br> }<br> return (T) childView;<br> }<br> }</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bced38249afa" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>