<?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 Adrien Desbiaux on Medium]]></title>
        <description><![CDATA[Stories by Adrien Desbiaux on Medium]]></description>
        <link>https://medium.com/@adriendesbiaux?source=rss-bf29d56aae16------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ewbhCbDrwbxHRRrcWTUuzQ.png</url>
            <title>Stories by Adrien Desbiaux on Medium</title>
            <link>https://medium.com/@adriendesbiaux?source=rss-bf29d56aae16------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 04:34:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@adriendesbiaux/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[Rocketbook — Everlast]]></title>
            <link>https://medium.com/@adriendesbiaux/rocketbook-everlast-f9131686bb85?source=rss-bf29d56aae16------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9131686bb85</guid>
            <category><![CDATA[notebook]]></category>
            <category><![CDATA[notes]]></category>
            <category><![CDATA[sketchnote]]></category>
            <dc:creator><![CDATA[Adrien Desbiaux]]></dc:creator>
            <pubDate>Wed, 04 Apr 2018 17:51:35 GMT</pubDate>
            <atom:updated>2018-04-04T17:55:46.610Z</atom:updated>
            <content:encoded><![CDATA[<p>Got the chance to stumble upon the Rocketbook from Everlast last January (2018). Since then I have used it intensively.</p><p>I was primarily looking for a way to write manual notes, avoid paper stacks and be able to save them in the cloud to multiple services if I wanted to.</p><p>Well Rocketbook has been designed for that! For the ones following the trend on <a href="https://www.jetpens.com/blog/sketchnotes-a-guide-to-visual-note-taking/pt/892">sketch notes</a>, I think you will be happy.</p><p>Since then they released the <a href="https://www.indiegogo.com/projects/rocketbook-everlast-mini-kids#/">Mini version</a>.</p><p>You can buy another set of pens Pilot Frixion line, if needed.</p><p>I bought it on <a href="https://www.amazon.com/gp/product/B06ZXWVZ3X/ref=od_aui_detailpages00?ie=UTF8&amp;psc=1">Amazon</a> and received it within a couple of days.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QAq6hM-ns7uU0lBdCN5mMw.jpeg" /></figure><p>I cannot be more exhaustive than this official video: <a href="https://www.youtube.com/watch?v=FL2aOGwm3Ak">https://www.youtube.com/watch?v=FL2aOGwm3Ak</a></p><p>I can just confirm that it is actually working as expected and even better than expected.</p><p>Hope this quick feedback found you well!</p><p>Cheers,</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9131686bb85" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hybrid Serverless Architecture]]></title>
            <link>https://medium.com/@adriendesbiaux/hybrid-serverless-architecture-8f1f0d7afb2c?source=rss-bf29d56aae16------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f1f0d7afb2c</guid>
            <category><![CDATA[aws-ecs]]></category>
            <category><![CDATA[lambda]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[sqs]]></category>
            <category><![CDATA[serverless]]></category>
            <dc:creator><![CDATA[Adrien Desbiaux]]></dc:creator>
            <pubDate>Sat, 08 Jul 2017 14:29:49 GMT</pubDate>
            <atom:updated>2017-07-08T14:29:49.644Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi everyone!</p><p>I decided to grab my pencil once again in order to describe one type of architecture mixing AWS Lambda and AWS ECS. I choose the term “Hybrid” because it indeed mixes the Serverless paradigm with the more traditional one based on EC2 instances and cluster.</p><p>You may end up building a such architecture because Lambda would be too <a href="http://docs.aws.amazon.com/lambda/latest/dg/limits.html">limited</a>: hardware specifications too short, language not available, not the OS you would like, not enough disk space, need a crazy amount of CPU, broader file system access, third party library required, need more memory. Or just because you are like me and you like complaining.</p><p>Here is how it looks like from helicopter:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sEMQCSYMioFOMAWwTVBpcw.png" /><figcaption>Lambda + ECS via SQS</figcaption></figure><p>All start at the Lambda function level: in charge of handling the workload thanks to its intrinsic scalability, it will make sure to enqueue every job to SQS. Then it will trigger a task (worker) in the ECS cluster which in turn polls the queue, to finally complete the job.</p><p>Any fails at the Lambda level will be covered by de <a href="http://docs.aws.amazon.com/lambda/latest/dg/dlq.html">Lambda dlq</a> and any fail at the cluster level will be covered by the <a href="http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html">SQS dlq</a> if consecutive retries appear unsuccessful.</p><p>The workload is managed by the ECS cluster by adding an <a href="http://docs.aws.amazon.com/autoscaling/latest/userguide/GettingStartedTutorial.html">Auto Scaling Group</a> having for rule to scale according to the number of jobs in the queue.</p><p>The ECS run a classic Docker container in which a worker.js will run. It is important to notice that the worker will run as a task and not as a service. Meaning, after the job is done, the ECS agent will terminate the container, the task. It is especially great in order to limit eventual memory leaks and hanging processes making the overall more robust to work load. See the overall process as a “super Lambda”, where for an incoming job from the SQS queue, a new worker is launched or reused. The hardware requirements allowing the workers/containers to run in the ECS are defined in the <a href="http://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html">task definition</a>.</p><p>You may dig into the <a href="https://github.com/AdrienFromToulouse/AWS-Hybrid-Serverless">code itself</a> for more details.</p><p>For an in depth amazing 3D IMAX experience a <a href="https://engineers.sg/video/building-hybrid-serverless-architecture-serverless-singapore--1872">short video</a> is also available</p><p>As Voltaire used to say:</p><blockquote>Sorry for my typos and my french accent. Comments and/or questions welcome.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f1f0d7afb2c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Morning warm up — Elevation Mask 2.0]]></title>
            <link>https://medium.com/@adriendesbiaux/morning-warm-up-elevation-mask-2-0-de283d64e4bd?source=rss-bf29d56aae16------2</link>
            <guid isPermaLink="false">https://medium.com/p/de283d64e4bd</guid>
            <category><![CDATA[fitness]]></category>
            <category><![CDATA[freeletics]]></category>
            <category><![CDATA[body-weight]]></category>
            <category><![CDATA[exercise]]></category>
            <dc:creator><![CDATA[Adrien Desbiaux]]></dc:creator>
            <pubDate>Sun, 21 Aug 2016 12:14:05 GMT</pubDate>
            <atom:updated>2016-08-21T12:14:05.795Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi everyone!</p><p>I just wanted to share a thought, a brain fart, about what I kind of discovered to be a good method to warm up before a morning workout. At least a good one to me!</p><p>I recently switched my training sessions early in the morning instead of late in the evening. I always had training in the evening even when practicing in clubs. I never had too much pain to warm-up after a day at the university or at work but when it comes to morning sessions, I am not really motivated and I feel like I am not doing it at 100%.</p><p>I tried many different ways to get correctly started: jump rope, shadow boxing and more… but nothing really nice.</p><p>I mentioned few months ago about the <a href="https://www.facebook.com/notes/adrien-desbiaux/elevation-mask-20-review/10207524303217563">Elevation Mask</a>. Since then, I did not really used it, because a bit hard to integrate it in my routine.</p><p>However I found the Mask very useful for warming up. I actually use it with the <a href="https://www.freeletics.com/en?gclid=Cj0KEQjwouW9BRCN0ozIifTI6_cBEiQAD9gNsT8qrwmvljQB6OdiWIAG0JSn6hg_UNFGeXD_KwutXagaAt8_8P8HAQ">Freeletics app</a> and some of the proposed exercises (free ones). I was not using Freeletics anymore. Therefore, it was also a good way to get back to it with parsimony.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pVMAYrPaLZ5iBFSR7XnoAw.jpeg" /><figcaption>Elevation Mask 2.0</figcaption></figure><p>The perfect combo for me in order to wake up my cardiovascular system and the motivation going with it, is the following:</p><p>The <strong>Krios</strong> workout (~5mins) + the <strong>Elevation Mask</strong> with the 1 air inlet setting. You can alternate between the different modes: Strength / Standard / Endurance. You will find a description of it right <a href="http://freeleticstraining.com/krios-freeletics-workout/">here</a>.</p><p>It is short enough to not get right away burnt, and if you try to complete it as fast as you can, I can assure you that with the Mask, you will feel the difference.</p><p>Having the mask forces you to breath intensively as soon as you get started. Using the app forces you to stick to the program and it gives a nice incentive to get started.</p><p>You get warm in less than 5 mins and ready to start your session in a good way.</p><p>Of course you could tell me that the <a href="http://www.trainingmask.com/">Elevation Mask</a> is somehow expensive but if you think twice, it is not more expensive than a brand new Nike gear right?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de283d64e4bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Lambda, Serverless, Node.js, micro/nanoservices - Part #1]]></title>
            <link>https://medium.com/@adriendesbiaux/aws-lambda-serverless-node-js-micro-nanoservices-part-1-2be647b07084?source=rss-bf29d56aae16------2</link>
            <guid isPermaLink="false">https://medium.com/p/2be647b07084</guid>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Adrien Desbiaux]]></dc:creator>
            <pubDate>Sun, 08 May 2016 15:11:58 GMT</pubDate>
            <atom:updated>2016-05-08T15:11:58.533Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi everyone!</p><p>Hope you are ready to step into the future. The future of DevOps and more likely the future of your daily life as a full stack developer.</p><p>The purpose of that small piece of writing is to give you an introduction to what is known as “serverless compute service”. The first to innovate in that field is of course AWS. A trend followed later on by <a href="https://cloud.google.com/functions/docs/">Google</a> and <a href="https://azure.microsoft.com/en-us/services/service-fabric/">Azure</a> (MS).</p><p>To give back to Caesar, I will only talk about AWS (I am not an investor).</p><p>AWS call that beautiful and bright future, <a href="http://docs.aws.amazon.com/lambda/latest/dg/welcome.html">Lambda Function</a>. So if you read <a href="https://medium.com/@adriendesbiaux/node-js-pm2-docker-docker-compose-devops-907dedd2b69a#.go4bqck70">my article about deploying your node app</a> then you will certainly hate me because you will basically destroy everything in order to pivot to AWS Lambda Function.</p><p>Prerequisite:</p><ul><li>Knowledge of AWS services: DynamoDB, SNS, API GATEWAY, CloudFormation and for sure Lambda Function.</li></ul><p>Because I am an adept of Emacs:</p><blockquote>The interesting thing about cloud computing is that we’ve redefined cloud computing to include everything that we already do. — Richard Stallman</blockquote><h3>Serverless</h3><p>Let me introduce to you <a href="https://github.com/serverless/serverless">Serverless</a>. A framework which will help you to launch your first AWS Lambda Function in the cloud.</p><p>If you wish to have a quick debrief about it… well you have to imagine a framework allowing you to deploy your code AND your stack at the same time. Meaning, now, YOU are a REAL full stack developer.</p><p>Indeed the greatness of that framework is that you can manage your code, Events, Endpoints and Resources from a single CLI. You can create dynamically any type of stage (dev, test, prod…) in any region (only the one where Lambda Function are enabled) and deploy your resources on that stage. As well, you will keep track of what and how your resources are part of your application.</p><blockquote>Working with Serverless, Node.js and AWS is an every day orgasm. (nice quote from myself to be reused in your own article) — Adrien Desbiaux</blockquote><h3>AWS Lambda</h3><p>Hereafter is an example among many of how your application could be transformed into Lambda. <em>By the way </em><a href="https://cloudcraft.co/"><em>Cloudcraft</em></a><em> is awesome to design your architecture.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KdsJU7Pmxyp_D-OU9AiCQA.png" /><figcaption>Example of serverless application</figcaption></figure><p>So basically, Lambda Functions are code that run only the amount of time needed to process a certain task. It can be a node.js, a JAVA or a GO app... All of them will run smoothly on Lambda. You pay only the amount of resources and time spent during the process. And it will automatically scale according to the amount of tasks you have to process.</p><p>Put into relation to the other AWS services, you get a very powerful architecture right out of the box. Meaning that DynamoDB can trigger a Lambda Function as well as a new file being uploaded on S3 or a message send on a specific SNS topic. More and more services will be part of Lambda Function soon.</p><blockquote>I’m going to use all my tools, my God-given ability, and make the best life I can with it. — Lebron James</blockquote><h3>Serverless + AWS = ♥</h3><p>Now that you got the big picture of those 2 entities, it is easier for you to imagine a single GitHub repo containing the mapping and configuration of all the services shown on the diagram above as well as the code running on each of the Lambda Function.</p><p>And it is also easy to go a bit further and imagine that someone else can fork your repo and deploy the exact same architecture on another region, on another stage, for his own need.</p><p>Then you arrive to the conclusion that a such approach would allow everyone to share their own microservice/app with their full stack. Not just a Docker image but the entire stack. From A to Z. From the software to the “hardware”.</p><p>For example, John Doe did a cool and efficient image processing microservice with nice performances. Then John Doe makes his microservice available on a marketplace.</p><p>You buy it and deploy it on your own region so that you can use John Doe’s microservice for your own need. You need to map another AWS service to it? Then modify the CloudFormation template given by John Doe and deploy the change to your stack. Done.</p><p>The first steps would sound like the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b01e541dd4b7578387bd6152e3234d0b/href">https://medium.com/media/b01e541dd4b7578387bd6152e3234d0b/href</a></iframe><p>In the next article I will go bit deeper on how to handle a Serverless project, especially on a multi-collaborative project.</p><p>What goes after the “dash deploy” command?</p><p>Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2be647b07084" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Node.js, PM2, Docker & Docker-compose DevOps]]></title>
            <link>https://medium.com/@adriendesbiaux/node-js-pm2-docker-docker-compose-devops-907dedd2b69a?source=rss-bf29d56aae16------2</link>
            <guid isPermaLink="false">https://medium.com/p/907dedd2b69a</guid>
            <category><![CDATA[docker-compose]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[pm2]]></category>
            <dc:creator><![CDATA[Adrien Desbiaux]]></dc:creator>
            <pubDate>Sun, 03 Jan 2016 13:58:44 GMT</pubDate>
            <atom:updated>2016-01-06T06:18:11.628Z</atom:updated>
            <content:encoded><![CDATA[<p>Happy new year 2016 everyone!</p><p>In order to start this year in the best auspices as a DevOps, I will describe how to deploy a job queue Node application with Docker, <a href="https://docs.docker.com/compose/">Docker-compose</a> and <a href="https://github.com/Unitech/pm2">PM2</a>. Hope it will give you some leads to deploy your own app.</p><p>I will keep it as dry as possible to limit the length of this article. For the details, I let you read the documentation of each one of the tools involved.</p><p>Let’s say your Node application run over a Nginx load balancer (proxy). Your Node application would be a <a href="https://medium.com/@adriendesbiaux/job-queue-with-node-js-26a880068daf#.p9m2y4fdp">job queue application</a> and so you might have roughly a <strong>server.js</strong> and a <strong>worker.js</strong> to run.</p><p>The overall application can then be deconstructed into the following parts:</p><ul><li>Nginx -&gt; Dockerfile</li><li>Node -&gt; Dockerfile</li></ul><h4>Nginx -&gt; Dockerfile</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f80f21b904b8fb15b9519930b4959dea/href">https://medium.com/media/f80f21b904b8fb15b9519930b4959dea/href</a></iframe><p>This Dockerfile calls an ENTRYPOINT in order to dynamically apply the right domain name in the <strong>nginx.conf</strong> file. For example if you wish to have different environments.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/557d18a4f4bc17160f4193b628ccc302/href">https://medium.com/media/557d18a4f4bc17160f4193b628ccc302/href</a></iframe><p>The Dockerfile also exposes the port 443 for SSL considerations and mount the folder/volume SSL present on the Host on which you will deploy your app.</p><p>Hence, in your project folder, under a nginx folder you will have the <strong>Dockerfile</strong>, the <strong>entrypoint file</strong> and of course the <strong>nginx.conf</strong> file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/321/1*QzjFUNzRixp-IMpD3BbpOw.png" /><figcaption>Nginx folder</figcaption></figure><h4>Node -&gt; Dockerfile</h4><p>In order to deploy in an efficient way your node app, I would highly advise you to use <a href="https://github.com/Unitech/pm2">PM2</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7574c6e40964996be5d43704e0b516f2/href">https://medium.com/media/7574c6e40964996be5d43704e0b516f2/href</a></iframe><p>Same here, we have an ENTRYPOINT doing certain things after the installation of Node and PM2. Then it exposes the port used by our <strong>server.js</strong>.</p><p>It runs the node application thanks to PM2 in no-daemon mode (otherwise your container will exit). The <strong>processes.json</strong> file is a PM2’s feature.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1ce21d289a3e39523833a012d1952cf0/href">https://medium.com/media/1ce21d289a3e39523833a012d1952cf0/href</a></iframe><p>Please <a href="http://pm2.keymetrics.io/docs/usage/application-declaration/">refer to the doc</a> for more info.</p><p>So basically what we are doing here is to deploy 1 server, 2 workers and a <a href="http://pm2.keymetrics.io/docs/usage/pm2-api/">PM2 watcher</a> in our container.</p><h4>Docker-compose</h4><p>Thanks to this wonderful tool, we can now bring up the application by putting all the pieces together. To do so, it requires the use of a YML file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3252a3280e42fb8e31aa8eb1261afa1d/href">https://medium.com/media/3252a3280e42fb8e31aa8eb1261afa1d/href</a></iframe><p>In this file you will link all the containers together.</p><p>For example <strong><em>docker-compose -f docker-compose-prod.yml up -d </em></strong>will build and run all the containers in a deamon mode.</p><ul><li>a container running a Redis DB used by your job queue application</li><li>2 containers running the Node application</li><li>1 container running Nginx</li></ul><p>All tight together by the different opened ports.</p><p>You can then build independently each one of them =&gt; <strong>docker-compose -f docker-compose-prod.yml build nginx &amp;&amp; docker-compose -f docker-compose-prod.yml up -d nginx </strong>will re-run the nginx container<strong> </strong>for example. Useful after an update of the nginx.conf file.</p><h4>Zoom on the nginx.conf</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7a1b3889244de614eeb74f8c855a33f7/href">https://medium.com/media/7a1b3889244de614eeb74f8c855a33f7/href</a></iframe><p>The container chooses the IP addresses suitable for itself. So in order to apply those IP to our nginx.conf we trust docker-compose i.e the <strong>docker-compose file </strong>=&gt; app1 / app2. The IP will both be distinct since they are a part of 2 distinct containers. This explain the choice to apply the same port number. It makes also the deployment and configuration files easier to maintain.</p><h4>Zoom on the Node app conf</h4><p>In order for our Node application to connect to the Redis DB, the image makes available the default connection settings via two main env variables:</p><ul><li>process.env.REDIS_PORT_6379_TCP_PORT</li><li>process.env.REDIS_PORT_6379_TCP_ADDR</li></ul><h4>Conclusion</h4><p>I tried in a very short overview to bring you some key elements in order for you to deploy your own Node application involving a Nginx load balancer, a Redis DB and a job queue architecture via PM2 and docker-compose.</p><p>Docker-compose makes the deployment of any complex application a real pleasure. Hope you will enjoy it!</p><p>Feel free to give your opinion and correct my typos :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=907dedd2b69a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Streaming + PCM data + websocket + web audio API]]></title>
            <link>https://medium.com/@adriendesbiaux/streaming-pcm-data-websocket-web-audio-api-part-1-2-5465e84c36ea?source=rss-bf29d56aae16------2</link>
            <guid isPermaLink="false">https://medium.com/p/5465e84c36ea</guid>
            <category><![CDATA[streaming]]></category>
            <category><![CDATA[web-audio-api]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Adrien Desbiaux]]></dc:creator>
            <pubDate>Sat, 31 Oct 2015 12:21:49 GMT</pubDate>
            <atom:updated>2016-05-08T14:12:21.344Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xZjz5SXM-o0dGdtFPOQFZg.jpeg" /></figure><p>This post is the first part of a 2 post series. It is about streaming raw PCM data from a server all the way through a client application, meaning the web audio API. The current Part 1 brushes the overall architecture. The Part 2 will describe how to handle multi clients.</p><p>So, let’s imagine you have some heavy audio processing to do. Your application in charge of it, for performances sake, is in C++. Furthermore, you don’t take the<a href="https://www.chromium.org/nativeclient/pnacl">Pnacl</a> option neither the <a href="https://github.com/kripken/emscripten">Emscripten</a> one.</p><p>Here is our first blocking point. How do we transfer the processed samples up to the web client? Well, Nodejs is a good friend in that case. Why? because they got the brilliant idea to implement UDP. So here is what we will do. We will receive the commands (to adjust the processing) and send the raw PCM data both via UDP. Of course it implies to modify your C++ application (Go or whatever) in order to implement UDP.</p><p>Then the second obstacle is: How do we transfer those data and commands from/to the client? Well, some nice guys did a very “simple” package to stream data via websocket. It is called <a href="https://github.com/binaryjs/binaryjs">Binaryjs</a>. I really like the simplicity of this API and also the way you have the stream/metadata associated. You can then use the metadata object as commands for example. All of a sudden you’ve got your protocol application designed.</p><p>The finish line is your speakers. How to get there? Well, some nice guys did a very “simple” API called web audio API. With that you can play whatever you want on the client side, all managed in Javascript.</p><p>The key element to use here is: <strong>createScriptProcessor.</strong></p><p>In order to limit the bandwidth, we just consider 1 channel. The code would look roughly like the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cd8d7559bcffad9f05ac49fe8a3ad35b/href">https://medium.com/media/cd8d7559bcffad9f05ac49fe8a3ad35b/href</a></iframe><p>You basically will write the raw PCM data to the right and left channel and move all along the raw data.</p><p>Finally via the interface of your web application you can send commands to the C++ one and then receive processed PCM data and listen to the change in real time or very close.</p><p>Hope this post gave you some ideas for your next hack weekend.</p><p>Thanks for reading and please let your constructive thoughts below. Cheers!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5465e84c36ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Job queue with Node.js]]></title>
            <link>https://medium.com/@adriendesbiaux/job-queue-with-node-js-26a880068daf?source=rss-bf29d56aae16------2</link>
            <guid isPermaLink="false">https://medium.com/p/26a880068daf</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[queue]]></category>
            <dc:creator><![CDATA[Adrien Desbiaux]]></dc:creator>
            <pubDate>Fri, 25 Sep 2015 14:38:35 GMT</pubDate>
            <atom:updated>2015-09-25T14:38:35.544Z</atom:updated>
            <content:encoded><![CDATA[<p>Job queue with Node.js</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*lM2q2re9yIuSuh-k9s0j2Q.jpeg" /></figure><p>This post is not about job offers, nor the never ending queue line at your nearby job center.</p><p>It is about executing heavy server side tasks requested by the client application and make them executed as fast as possible.</p><blockquote>“small, sharp tools” — Andrew Hunt &amp; David Thomas</blockquote><p>Let’s install a couple of tools. Basically you need node.js, PM2 and Kue.</p><h4>PM2</h4><p>Back in the day, this is the kind of tool you would have paid for in order to have something reliable on production with Node. You can thank <a href="https://twitter.com/strzel_a"><strong>Alexandre Strzelewicz</strong></a><strong> </strong>for it (you always need a french in your team).</p><p>What it does is very nice. It will <a href="https://keymetrics.io/2015/03/26/pm2-clustering-made-easy/">cluster your application seemlessly</a>. You could do that with <a href="https://github.com/hunterloftis/throng">Throng</a> “inside” your code, but from my point of view it is better to keep your app decoupled. However, you have to design your app to be “cluster ready”.</p><h4>Kue</h4><p><a href="https://github.com/Automattic/kue">Kue</a> is a priority job queue backed by Redis for node.js. It will handle all the jobs queue for you. Very simple, you push a job into the Redis DB and your workers will execute the job. Kue takes care of all the logic in order to keep the overall consistency, i.e dispatching the jobs to the workers, detect pending, stuck jobs etc…</p><blockquote>“The value of a prototype is in the education it gives you, not in the code itself.” — Alan Cooper </blockquote><p>Let’s say you catch a POST with ExpressJS, and right after it pushes a new job to apply a Bessel filter to an image:</p><p><em>var kue = require(‘kue’),</em></p><p><em>var jobs = kue.createQueue();</em></p><p><em>app.post(‘/’, function(req, res, next) {<br>var jobArgs = req.body, job;</em></p><p><em>job = jobs.create(‘bessel-filter-image’, jobArgs).save();</em></p><p><em>job .on(‘complete’, function(</em><strong><em>result</em></strong><em>) { //whatever you want to do }) .on(‘failed’, function() { console.log(job.id); });</em></p><p>});</p><p>jobArgs could contain the image and some other useful data necessary to complete the job.</p><p>So we have our producer, now we need our consumer &lt;=&gt; worker</p><p><em>jobs.process(‘bessel-filter-image’, function(job, done) { console.log(job.data.whatever); // stored in jobArgs<br>var result = bessel(); // let’s imagine applying the filter<br>done(null, </em><strong><em>result</em></strong><em>); // forward the result of your job<br>});</em></p><p>In order to run the beast in your terminal:</p><p>pm2 start server.js</p><p>pm2 start worker.js -i 4</p><p>We launch the server and then the workers. In that case we decide to launch 4 workers because we have 4 cores. PM2 can anyway detect the number of cores for you.</p><blockquote>“The first draft of anything is shit.” — Ernest Hemingway</blockquote><p>As a first post, I tried to give you a dry overview of job queue with node.js. And some clues on where you can look for. To finish here is two links:</p><p>Alternative to Kue: <a href="https://www.rabbitmq.com/">https://www.rabbitmq.com/</a></p><p>I would recommend you to have a look at this gold mine: <a href="https://devcenter.heroku.com/">https://devcenter.heroku.com</a></p><p>Cheers!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26a880068daf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>